4 ms·
Anywhere you actually need React (and also React lite solutions like Preact or Alpine), which is essentially where your page isn't just a static page, web compo
by lordgroff 4y ago
Anywhere you actually need React (and also React lite solutions like Preact or Alpine), which is essentially where your page isn't just a static page, web components by themselves don't do anything to handle the complexity of state. But what they allow you to do is to use the same component in whatever framework you pick.
- bobthepanda 4y agoYeah, what I like about React is how declarative component writing is, and how you delegate state changes to escape hatches. Plain old HTML is supposed to be declarative but updating with vanilla JS quickly gets you into the weeds. I tried to get into WebComponents, but the MDN tutorial has you writing a lot of `document.createElement` and `document.appendChild`, which is the sort of imperative stuff I don't like about vanilla JS DOM manipulation.
- vagrantJin 4y ago> delegate state changes to escape hatches Ay. Can you please explain what this means in simple, 5th grader English?
- bobthepanda 4y agoReact says what things should be, given a limited state. (These elements read X, and update when X changes.) Vanilla JS says how to do things (find these HTML elements and update them by doing X). It is much simpler to track and mutate a state object, than it is to find all the nodes you need to update and update appropriately.