News for hackers. Stuff that matters.
Re:If Web Components are so great, why am I not using them? by benatkin on Wednesday August 02, 2023 @07:10PM (#36979145)
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

Re:If Web Components are so great, why am I not using them? by spankalee on Wednesday August 02, 2023 @08:30PM (#36979791)
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.
Re:If Web Components are so great, why am I not using them? by benatkin on Thursday August 03, 2023 @12:54AM (#36981536)
> 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/

Re:If Web Components are so great, why am I not using them? by phpnode on Thursday August 03, 2023 @06:11AM (#36983739)
When did @click and so on become part of HTML?
Re:If Web Components are so great, why am I not using them? by dannye on Friday August 04, 2023 @11:11AM (#37001126)
If Lit is equivalent to Svelte, then BASIC was equivalent to COBOL