Hacker News new | ask | show | jobs
by herpdyderp 1049 days ago
I've been using web components now for years and I will do everything I can to never write frontends in anything else. I totally agree with point 2 though: the Polymer phase was very weird, but, as mentioned, https://lit.dev is great and, imo, the perfect abstraction.
5 comments

Lit seems functionally equivalent to Svelte. Might Lit only be better if you have a preference towards declaring classes? Perhaps tracing back to Backbone or React before hooks?

Svelte supports custom elements: https://svelte.dev/docs/custom-elements-api

Lit uses standard languages, doesn't require a compiler, is faster, and is smaller as you amortize the library size over a collection of elements. Those are real differences.
> uses standard languages, doesn't require a compiler

It recommends a build step, but yes, you can use it without one. Also, TypeScript isn't a standard language. So if you're using .ts you may as well use .svelte.

> is faster

I don't know that Svelte has been benchmarked with custom elements. Either way it's plenty fast.

> is smaller as you amortize the library size over a collection of elements

That's kind of a funny thing to worry about. It has improved in Svelte 4, though. https://svelte.dev/blog/svelte-4 I also don't know that Lit is so small in practice. With Lit you get to use map and the ternary operator and all that jazz, like React. https://lit.dev/docs/templates/conditionals/

When did @click and so on become part of HTML?
If Lit is equivalent to Svelte, then BASIC was equivalent to COBOL
Would love to peruse a couple example repos for learning if you can share some public links.
Not parent, but I wrote some components based on lit-js, they're here: https://git.sr.ht/~mariusor/oni/tree/master/item/src/js. The top level call would be oni-main-actor.render()

However I am a total noob so it might not be entirely idiomatic. An example for the end result is at https://releases.bruta.link

Lit is so good. It’s just enough extra on top of native web components - to be useful, but without feeling like it stacks a bunch of extra bullshit. I really wish more teams were into it.
It looks good. But it is a Google project, and with Google's DRM attack on the web I don't know if I'm willing to give these more traction by being among the user base.
lit looks like someone's trying to make a GUI in java, what is the need/deal with these annotations etc?