3 ms·
React exists because Facebook needed to sync DOM elements in different parts of webpage with a single source of state. There is still no global standard that so
by sesm 3y ago
React exists because Facebook needed to sync DOM elements in different parts of webpage with a single source of state. There is still no global standard that solves this problem.
- gedy 3y agoYeah I think some people glorify "simple", low level solutions, which work fine for sprinkles of interactivity. But if I'm building a non trivial UI application - give me a framework please!
- marcosdumay 3y agoYou mean state handlers? Those are one of the main reasons people adopted OOP at the 80's. The observer pattern got pretty much standardized by the GoP book, but people overwhelmingly prefer to run some non-standard specialized thing, as it's usually much simpler. It's a pretty much solved problem since way before a lot of current developers were even born. All of (ok, a lot of) the React's complexity comes from it being a generic library that must support every kind of usage. Any standard would have to be as complex.
- reactordev 3y agoBS there’s custom elements and classes and the ability to target them with a selector. This is standard now. Web components.
- nicoburns 3y agoWeb components don't really do the same thing. If you use web components then you still need to manage the DOM manually.
- MrJohz 3y agoWeb components solve encapsulation of structure, style, and behaviour within a single component, but they don't solve the larger state problems, because web components don't come with any sort of state management beyond what you can do with normal Javascript. React does provide components, but there's not so much different in React components than any other component system. The main reason to use React is the state management it provides on top of those components, making sure that state is in sync across the whole application. In my experience, the hard part of larger applications is that handling of application state. Rendering data can be done in umpteen different ways, and they're all pretty much good enough, but handling application state in such a way that every component remains in sync with all other components is hard.