Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> mixes UI snippets with code

You can never really avoid it unless you only use HTML. Templates are code. I think JSX is nicer because it's fully featured and the same syntax as regular JS, not a subset limited template language



I haven't used Twig, but have used other PHP templating engines. Scope is the big deal for me. JSX has actual scoping (it's just JavaScript), function calls, etc. PHP templates have one scope, even when you enter an included sub template.

Laravel released template components in version 7, but I haven't been able to try them yet and I'm hoping they'll improve things.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: