Comment by curtisblaine
18 days ago
Managing state and syncing it to the DOM manually is much harder than React (or any other big framework) for any non-trivial web app. Reactive, inherently asynchronous, event driven applications get complex easily.
Right. I encourage young devs to build a complex app using vanilla js. Feel the pain of two way state management. Then you’ll gain an appreciation for react. And you’ll learn browser APIs and know when react is overkill because it has its own pain
i’ve tried this, and it almost almost works to just rebuild the Dom on every state change as a pure function of state without any react or anything. The resulting interface is actually way snappier than react – but preserving local state of elements like what text is highlighted, where the cursor is, which radio button is tabbed to etc turns into a nightmare.
With all due respect, I don't believe it is "more snappier than react".
React itself with nothing else is plenty fast. You would have to go way out of your way to see performance differences between different UI approaches, computers are just way too fast to notice whether this click resulting in the div's text changing to +1 is slow or fast, even if the implementation were crazy convoluted.
What makes react apps slow is using it badly, and having 10 other libraries getting in the picture loading fat UI elements, etc.
And frankly these would be much slower in your render everything anew approach.
1 reply →
Based on your description it sounds like you were halfway into reimplementing the virtual dom that react uses (or use to use? unsure if they moved away from that with the implementation of a compiler).
1 reply →
And, you'll know why this statement
> But for several years we've been able to style radio buttons however we want using a few CSS tools
proves how good the current state is, where a dev can think things will just be ok, for everyone, if you just ripped all that complexity and ship it (which should be the attitude for a good framework).
It's not even the young devs. It looks like most of those complaining are back end developers who "rarely tinker with frontend" but think they can teach everyone else how to make it simple because "it should be static forms".
A great example of all-world-is-a-nail stance mixed with extreme hubris.
I did spend a serious amount of commercial time developing fronted UIs in React, Angular, and the before times in vanilla JS/css. I even wrote my own UI framework in Web Components, developed my own CSS framework used by an agency churning out projects for years. You get the idea, I did the thing, commercially, for over a decade. React and Angular are absolutely more complex in practice. That's fine, if you want the features go ham. But you don't need them, and most people mis-use the power and end up with a slow complex mess.
Perhaps those same people would have a slow complex mess in vanilla tools too though, so maybe React is a scapegoat like PHP was, and Javascript was.