3 ms·
The evolution of lit is fascinating to watch because it's built and promoted by people with rather visible and public dislike of everything React. And yet, it's
by troupo 1y ago
The evolution of lit is fascinating to watch because it's built and promoted by people with rather visible and public dislike of everything React. And yet, it's already turned into React-lite.
- Custom HTML-like syntax
<button @click="" .disabled="" />
- Custom Javascript rules
// valid JS, invalid lit
const tagName= "a";
`<${tagName} href="">Some link</${tagName}>`
- Custom rules for special functions.
// classMap looks like a regular JS function, but it's not.
// Both of these will produce an error
<div class="my-widget ${classMap(dynamicClasses)} ${classMap(dynamicClasses)}">Static and dynamic</div>
<div data-class="${classMap(dynamicClasses)}">Static and dynamic</div>
- Context https://lit.dev/docs/data/context/ https://lit.dev/docs/data/context/
- Experimental compiler: https://github.com/lit/lit/tree/main/packages/labs/compiler#readme https://github.com/lit/lit/tree/main/packages/labs/compiler#...
- jfagnani 1y agoYou have a very large axe to grind against web components and Lit, and you show up just about everywhere to make the same comments, but I'll play along anyway: Yes, Lit templates give some special meaning to attribute names with a few prefixes. No, it's not "HTML-like". It's valid HTML. Not that it matters much. You bring this up all the time but I'm not sure what the actual criticism is. Developers seem to understand the small syntax carve-out just fine. No, there are no custom JavaScript rules. Templates have some rules. I'm not sure why they wouldn't? In general you can't make things like tag and attribute names dynamic because you can't change them in HTML. You can actually write the template you show with what we call static templates though. `classMap()` is a template directive. It has some rules about how it's used in templates, just like other JS functions can have rules about how their used. I'm not sure what makes that not a function. But to your main point: Lit is not like React because it's not a framework. Lit helps you make custom elements - it's an implementation detail of some web components. Everything else about those elements: how you instantiate them, style them, where they work, etc., is all defined by the HTML and DOM standards. React is a framework, and defines its own rules about how its components work.
- troupo 1y ago> You have a very large axe to grind against web components and Lit Yes, yes I do. Because Web Components are almost 15 years now, and they still struggle with the most basic of things. How's that abandoned roadmap going? https://w3c.github.io/webcomponents-cg/2022.html https://w3c.github.io/webcomponents-cg/2022.html > No, there are no custom JavaScript rules. Templates have some rules. That is "here are regular JS functions. However, you cannot use them as regular JS functions in these specific contexts". Reminds me of certain very specific rules about specific functions in specific contexts in some other framework. Can't put my finger on it. > I'm not sure what makes that not a function. I never said it doesn't make it a function. > But to your main point: Lit is not like React because it's not a framework. Yeah, React wasn't a framework either, but just a library. Everything about DOM elements that React produces, how you instantiate them, style them, where they work etc. is all defined by the HTML and DOM standards. But then React grew in the number of features, and can no longer be called a library even though still the only thing it does is output some DOM nodes. I guess you'll insist on Lit being "just a library" even after it adds a ton of other functionality all other frameworks already have or are moving towards. > I'm not sure what the actual criticism is The criticism is usual: Lit is rapidly absorbing all the features from all the other frameworks and becoming a framework itself while many of its developers and proponents can't stop shitting all over other frameworks.
- mariusor 1y agoAs a third party I can't help but notice that the only one doing the "shitting" here, is you.
- troupo 1y agoYou don't have to take only my word for it https://news.ycombinator.com/item?id=45118434 https://news.ycombinator.com/item?id=45118434
- mariusor 1y agoI'm not sure how those links support your "lit proponents shit on other JavaScript libraries/frameworks", which was my complain about your post, or if that would even warrant as an excuse for you personally being an ass to the lit's maintainer directly.
- afavour 1y agoI’m not one of those people but I don’t see an inherent conflict in what you’re saying. My #1 criticism of React is its size and monoculture, so a React-lite alternative sounds intriguing to me. Much like Preact, which I’ve used a ton.