Re:Web Components Eliminate JavaScript Framework Lock-In
by zaphar on Monday November 27, 2023 @04:41PM
(#38438795)
You don't have to use innerHtml. The ShadowRoot pretty much acts like a document. So you can also use appendChild. Combined with a template element you can completely avoid innheHtml. You could even use jsx to create the template element I suppose.
That said I think this is mostly a non-issue.
Re:Web Components Eliminate JavaScript Framework Lock-In
by itronitron on Monday November 27, 2023 @04:26PM
(#38438574)
For me, it feels weird to have four file types I need to manage in order to define a UI, instead of just one.
Re:Web Components Eliminate JavaScript Framework Lock-In
by nbe on Monday November 27, 2023 @03:47PM
(#38438039)
lit [1] provides declarative templates for web components for example.
[1] https://lit.dev/
One issue I see though and I almost feel dumb for saying it, I don't like how web component code looks. Using innerHTML feels really weird when your team is so used to using JSX for react components for example. I don't think this would stop me from researching web components more but does anyone feel similarly or have a solution or obvious answer for me in this area?