DEV Community

Framework Interoperable Component Libraries Using Lit Web Components.

Tea Reggi on October 08, 2023

TLDR: This post is made to rave about repo I found called json-schema-form-element a lit-based component library for form generation that works wi...
Collapse
 
dannyengelman profile image
Danny Engelman • Edited

In 2006 I bet on jQuery to be the future of the Web

And then the browser vendors implemented things like querySelector IN the Browser...

So what happens when Apple, Mozilla and Microsoft do not implement Google Lit syntax into the Web Component standard?

Those 4 might be working together in the WHATWG; but they are still competitors. And I presume none will let Chromium grab 100% Browser market share (We would all be stuck on AMP now)

In jQuery days there were some 20 alternatives. I have worked at 2 companies where they bet on the wrong horse.. and had to ditch 1/2 million euros.

There are 60+ Alternatives to Lit; have you tried them all?

Collapse
 
0xdonut profile image
Mr F.

I picked up jQuery at the same time. Even though browsers implemented a lot of ideas and JS itself also adopted ideas, there's no doubt jQuery made it much easier to develop sites.

I think Lit is also the winner in the long term because it leverages web components, which are also being built into the browser. Over time you might not need Lit, but everything you've picked up and learnt will still be relevant.

Collapse
 
reggi profile image
Tea Reggi

I'm observing that companies like Adobe and Microsoft are increasingly adopting Lit, which challenges React's dominance. While jQuery remains prevalent, Lit is likely to persist similarly.

According to BuiltWith's Internet technology trends, jQuery powered over 80 million websites in 2022. This is a significant lead compared to the nearly 11 million websites that used React.

The paramount concern is SSR (Server-Side Rendering). Until there's a native web component-to-string browser API that runtimes—and ideally other languages—can utilize, we're in a standstill. I doubt native browsers will prioritize server needs, particularly SSR/SSG. There might always be a need for third-party intervention to bridge this gap.

I'm receptive to any web component libraries or frameworks supporting SSR/SSG or "HTML stringification" (and ideally hydration).

Comparing jQuery to Lit isn't accurate. The web is gravitating towards servers. For evidence, consider what Next.js/Vercel has achieved with React.js. The way forward appears to hinge on a web standard, and currently, web components are our best bet and it's up to libraries like jQuery and Lit to invent what the APIs and interfaces should look like and pave the way for standardization.

Collapse
 
dannyengelman profile image
Danny Engelman • Edited

SSRG isn't something new.
The Internet is on a 15 year cycle favoring Servers versus Clients.
30 years ago I did Gopher, 15 years ago SharePoint

Thread Thread
 
reggi profile image
Tea Reggi

I didn't say it's new I said getting browsers to care about it is.

Thread Thread
 
dannyengelman profile image
Danny Engelman

SSR is a minor issue, has been done for over 30 years, just needs to be implemented.
The WHATWG recently started discussing about Web Component persistence between browser sessions.
That is a biggie.

Collapse
 
elad_cohen_366d4c6bb6f506 profile image
Elad Cohen

Hi
Lit was born out of polymer framework
Which was born from GWT, its has 15+ years of background
YouTube, gmail, IBM Carbon are lit components.

But what is the main difference between LIT and React ??
Lit is a template engine on top of Webcomponents. Like jquery it’s a library..:
React on the other hand is a library which pretends to be a language…

And bear me out :
If you won’t master the new web, you’ll be out of job

Collapse
 
dannyengelman profile image
Danny Engelman • Edited

_If you just embrace something new, because it is new or developed by a behemot company. You will be out of a job.

I did Angular development when the version number started with 0
And then Google called Angular 2 an Upgrade (it was a new language)

I am in this Internet business for 34,5 years now,
and have mostly seen companies and technologies go instead of stick around

Bud Colligan (CEO Macromedia) taught me a valuable lesson in 1994
Danny, every product has a lifecycle when I bugged him why they were not upgrading Authorware fast enough imho. It took another 13 years for Authorware to "go"; not because of its technology, but because Adobe bought Macromedia for Flash only and moved Authorware development to India, and them developers just couldn't fix the bugs.
A yes, Flash... I still hear my trainees in 1995 say Danny, this FutureSplash plugin is cool!

Technology is not about technology

The Web Components world is in flux. There are no clear "jQuery/React" style winners yet.
Web Awesome just got 671K backing - kickstarter.com/projects/fontaweso...
Will they "win"; I really do not know, but they for sure will get some momentum

Just finished a Olympic Medal Ranking Web Component using only native JavaScript.

Lit or any other soup-starter would not have saved me time.

I know one thing for sure: This Web Component will work for the 2028 Olympics in LA and the 2032 Olympics 2032 in Brisbane without any refactoring or errors or failing build-version (provided the data-API does not change) because it is native, standard technology.

If you want I can sent you my Angular 0.14 code, see how long it will take you to build that again.

Thread Thread
 
elad_cohen_366d4c6bb6f506 profile image
Elad Cohen

My dear friend
We speak the same ,
I use lit because it’s an excellent literal and template engine.

Same as you , I wrote my first code on Basic on Atari back in the 80s

Do you remember backbone js ??
Backbone & React are giving me a Deja vu

Thread Thread
 
elad_cohen_366d4c6bb6f506 profile image
Elad Cohen

And I wish to add couple important things.

Use a testing browser and disable : transitions & shadow borders , on react app. You know what will happen? You will find a large scale scam.

React is slow !!!! It uses css tricks to mimic speed.

Thread Thread
 
dannyengelman profile image
Danny Engelman • Edited

Everything is a Déjà vu - youtube.com/watch?v=yJDv-zdhzMY

The only thing that makes Web Components great, is four companies working together.

That is something I have never seen before.

Lit is great because from the start it was presented as the disappearing layer
Should you learn Lit, YES!
Should you use Lit, well, it depends, maybe not.

Every tool or technology has a spark of greatness, but it should always be a spark for standards

Image description

I peeked and poked Lit code, then wrote my own literal and template engine

DEV.to Spritemeister

Thread Thread
 
dannyengelman profile image
Danny Engelman • Edited

FYI I never learned React.

I was in the Microsoft SharePoint world for many moons and dollars.
I could do everything with client-side tech.
And then Microsoft switched to React, I found it to not be interoperable with other client-side technologies and left the Microsoft world for the Web Component world. I can truly say I could have earned 500.000 dollar more over the past 7 years had I "done" React.
Same applies to Svelte, you can build stuff, you can't tweak stuff, like you can with Web Components

Image description

source: stackoverflow.com/questions/643043...

Collapse
 
reggi profile image
Tea Reggi

Thoughts?

Collapse
 
elad_cohen_366d4c6bb6f506 profile image
Elad Cohen

Tomas well done !!

Collapse
 
juliancataldo profile image
Julian Cataldo • Edited

Thanks for your kind words @reggi ☺️ Just found out your article after an unrelated Google search (about Lit SSR, for Gracile).
I'm happy that this project gave you more confidence in the interoperable web.
One of the main block I see right now is the ability for React to distinguish between attributes and properties. Actually, the lines are blurred, and consumers lack flexibility.
Solid, with its namespaced prop:/attr:/on:/… has the nicest approach to keep Custom Elements declarative in JSX, e.g. accessing their internal events, etc.

Collapse
 
fredt34 profile image
fredt34

Thanks for the link to jsfe.js.org/ - I'm going to add it on my experimental stack:

  • Bun (I never could understand node)
  • EdgeDB, because JOINs suck + it makes no sense describing your data both in your schema and your classes - EdgeDB generates all your classes
  • Elysia for route management and SSR
  • htmx because the whole C/S via json and APIs are so unnatural
  • + probably Shoelace for the Web Component UI (unless you guys can recommend other component libraries?) + some more components (probably SmartTable - it's free along a Tree component) - because InterOperability!
  • and perhaps jsfe because I'm lazy and I prefer specifying the UI (or have it generated from the DB) rather than coding it (or other solutions, but jsonforms.io/ only generates react / vue / old crazy stuff). I've been using AlpacaJS for 10+ years, but jquery is not necessary any more.

I feel Web Components and html are ways to make things lighter, not bulkier (I never wanted to dive in react / vue / angular and the like and spend months, if not years, learning them).