4 ms·
> React’s logical model of recreating the UI on change of state is incredibly difficult to do right at scale. What's much more difficult at scale is doing this
by mikeocool 3y ago
> React’s logical model of recreating the UI on change of state is incredibly difficult to do right at scale.
What's much more difficult at scale is doing this without React.
In the old days when building a complex front-end web app, your app would slowly devolve into complex web of event handlers changing the DOM, and you'd eventually arrive at the conclusion that you'd eventually arrive at the conclusion that centralizing state and triggering UI updates based on those changes was the only sane thing to do. And then you'd end up either: 1) re-rendering the whole DOM on ALL state changes -- which came without its own set of problems of which performance was just one, or 2) manually hooking up callbacks to change pieces of the DOM as the relevant pieces of state changed -- which was only slightly less of a nightmare to maintain then the event handler spaghetti you were coming from. Also another dev your team would always just hook up and event another event handler to change the DOM somewhere, and ignore your state entirely.
React actually made this both much more performant and much easier to maintain.
If you aren't building a complex web app with a lot interconnected interactions and state changes, you don't have to use React. If you are, I encourage you to build it with jQuery, and look forward to your follow up blogpost.
- fellowniusmonk 3y agoReact was the first front end js framework that passed the smell test, it just looked right. If you'd worked in UI generally the popular libraries of the time like backbone, angular 1, ember, knockout, etc. clearly were flawed and chaotic (with apologies to mithril and a few others.) and would obviously quickly spaghettify. These days between template literals, indexeddb and a simple library like morphdom you can write fast, predictable, queriable UI's that are offline first, persistent and easy to refactor and decouple components if your data model changes. The problem with front end UI in js was that instead of being logical and operating off of some kind of persistent DBesque data model that you could query and increment.. you were stuck with ephemeral data and your UI was built off of arbitrary API calls that disjoint the consumption of and hide the underlying data model. Rendering complex UI without the backing of proper data tools will not be clean or comprehendable over time.
- mrits 3y agoI didn't have much issues with angular 1, especially in the later days of it.