Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yeah, 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.



> delegate state changes to escape hatches

Ay.

Can you please explain what this means in simple, 5th grader English?


React 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: