News for hackers. Stuff that matters.
Re:Ask HN: What happened to vanilla HTML/CSS/JS development? by hellcow on Friday September 09, 2022 @12:36PM (#32781445)
That’s actually all I use for state management. Elements pass data to children through attributes and bubble data up through events. It’s worked well for us on a complex front-end using native web components.
Re:Ask HN: What happened to vanilla HTML/CSS/JS development? by bornfreddy on Friday September 09, 2022 @12:54PM (#32781751)
That's basically a home-made React (& co.) duplicate (which is great). This simplifies development considerably, because you break the original problem into a) updating the state and b) translating the state into UI elements, and the framework (hopefully) automatically updates UI as needed.
Re:Ask HN: What happened to vanilla HTML/CSS/JS development? by have_faith on Friday September 09, 2022 @01:58PM (#32782695)
This is called prop drilling. It technically works for any size or complexity of app if you're willing to make every intermediate component have knowledge about every possible piece of state that might be wanted by a component lower in the tree. It's extremely cumbersome though.
Re:Ask HN: What happened to vanilla HTML/CSS/JS development? by P5fRxh5kUvp2th on Friday September 09, 2022 @02:08PM (#32782830)
Back in my day we could search for child elements with specific attributes without needing the intermediate elements to know anything about it.

What REALLY happened is the shadow DOM. People decided it was too slow and created an intermediate representation. That then created all kinds of OTHER problems that started resulting in solutions that wouldn't have been necessary without the shadow DOM.

A shadow DOM is basically a cache, with all the problems that entails.

Re:Ask HN: What happened to vanilla HTML/CSS/JS development? by dalmo3 on Friday September 09, 2022 @06:43PM (#32785783)
> Note that the shadow DOM is not a new thing by any means — browsers have used it for a long time to encapsulate the inner structure of an element.

https://developer.mozilla.org/en-US/docs/Web/Web_Components/...

Re:Ask HN: What happened to vanilla HTML/CSS/JS development? by P5fRxh5kUvp2th on Friday September 09, 2022 @07:44PM (#32786209)
And for even longer than that, it was a term describing the technique of keeping a tree-like structure that would gather updates so you could eventually update the actual DOM all in one go because updating the DOM piecemeal was slow.

The term was popularized long before "web components" was a thing, and in fact, that's where they got the name.

Re:Ask HN: What happened to vanilla HTML/CSS/JS development? by creatable on Friday September 09, 2022 @10:03PM (#32786991)
Do you mean virtual DOM?