DEV Community

loading...

Discussion on: Why I'm not a fan of Single File Components

Collapse
ryansolid profile image
Ryan Carniato Author

Technically I support Tagged Template Literals, but it is bit of a pale imitation. None of the compiler goodness since I find it inconsistent to have Tagged Template Literals with the same syntax not work runtime only. So that means manually wrapping expressions and opting out of some performance optimizations. To be fair it is still the fastest Tagged Template implementation out there as it JIT compiles to similar code to Solid's JSX, and still outperforms all the popular libraries in benchmarks. But it means worse DX and bigger bundle size as can't aggressively Tree Shake. Solid uses JSX the way Svelte uses templates in it completely changes what is there and optimizes bundles based on usage. The output is nothing like a HyperScript or a VDOM library.

I understand the dislike for JSX, but all the toolings already there (Parsers, Syntax Highlighting, Babel, Prettier, TypeScript) from day one. I don't think Solid would be so fully featured today if it weren't for me being able to avoid completely re-inventing the toolchain. It's taken Vue/Svelte years and it still is WIP. Honestly I'm a bit surprised more non-VDOM libraries didn't go this way. To build a Template engine like those with that level of sophistication would take me years by myself.

Collapse
richarddavenport profile image
Richard Davenport

I completely agree with you. I think Solid looks awesome, and if I decide to give JSX another shot Solid is what I'll be using. Thanks for your work!