←back to thread

218 points mdhb | 1 comments | | HN request time: 0.455s | source
Show context
rs186 ◴[] No.44392025[source]
The author was a core contributor of Google's Lit project: https://github.com/lit/lit
replies(1): >>44393956 #
mock-possum ◴[] No.44393956[source]
Lit my beloved

God I love lithtml’s tagged template literals so much more than react’s JSX or Vue’s 3-in-one thing. It’s just html, in strings, in JavaScript. Lit is just a way to make custom elements easier. Man it’s gonna suck when I have to move on from my current gig and get my hands dirty with react again.

replies(1): >>44394628 #
troupo ◴[] No.44394628[source]
> It’s just html, in strings, in JavaScript.

It's not. It's a custom HTML-like syntax with lots of custom and weird rules.

replies(2): >>44396716 #>>44400368 #
yoz-y ◴[] No.44400368[source]
It’s similar enough to html that anybody familiar with html and JS can pick it up. Quirks it has, but I like that using it mostly just feels like building a huge html string.
replies(1): >>44400513 #
1. troupo ◴[] No.44400513[source]
> It’s similar enough to html that

"Similar enough" is a far cry from "It’s just html, in strings, in JavaScript"

> anybody familiar with html and JS can pick it up

Just like JSX. But no one calls JSX "just HTML" (and in React, with rules of hooks, it's no longer "just JS"). In Solid JSX returns actual DOM nodes btw.

> it mostly just feels like building a huge html string.

Because that's what you essentially do. lit runtime parses your custom string, converts it to proper HTML, concatenates that into a string, and then dumps into the document with innerHTML (it does set up data bindings etc. , so it's more than just thay of course)