Hacker News new | ask | show | jobs
by triyambakam 1458 days ago
> 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

1 comments

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.