News for hackers. Stuff that matters.
Re:Alternatives to JSX by itsbits on Monday February 25, 2019 @07:29AM (#19245124)
lit-html surely does a good job..

- ES6 string literals

- partial template rendering

are few cool features with it.

Re:Alternatives to JSX by westbrookj on Monday February 25, 2019 @12:17PM (#19247278)
lit-html is great!

- no build step

- ergonomic

- fast

- flexible

- useful whether alone or in a library/framework wrapper (see LitElement, https://lit-element.polymer-project.org/, Haunted, https://github.com/matthewp/haunted, et al.)

Getting just about all the convenience of JSX with the ability to have your templates run in pure JS in the browser, with no build step is pretty rad. Even if the difference is just a few seconds here or there, multiply that by the amount of work I'm supposed to be getting done in a day, and it starts to add up.

It's also nice to have control over whether to work with attributes or properties. A level of control that is mirrored by having direct access to event binding (rather than an abstraction of it) so you can pin down whatever custom events you might be passing around your application.

Maybe that's my favorite part, you get control. Whether via the time you get back, the say you have over your templates, the interoperability of your code, you have it with lit-html in a way that JSX hasn't really allowed me to in my experiences with it.

Re:Alternatives to JSX by lauritzsh on Monday February 25, 2019 @10:16AM (#19246175)
I haven't looked much into lit-html but is it possible to type check your templates like you can do with JSX? That is one big advantage I found for JSX compared to template-based frameworks.
Re:Alternatives to JSX by Technetium_Hat on Wednesday February 27, 2019 @12:09PM (#19264753)
All components, expressions, etc are in template curlies `${}` so type checking works out of the box. If you mean type checking on HTML properties, no it does not.

Lit HTML seems very extensible, so it should be possible to add support for thus.

Re:Alternatives to JSX by spankalee on Monday February 25, 2019 @12:05PM (#19247129)
It's possible. There's a VS Code extension that does this already called lit-plugin. If it becomes easier to add TypeScript compiler plugins via configuration, then I'm sure one will appear, allowing errors at build time.