3 ms·
I though React, et al were originally created as a better way to manage DOM updates (shadow DOM). Has that need gone away?
by irrational 3y ago
I though React, et al were originally created as a better way to manage DOM updates (shadow DOM). Has that need gone away?
- evan_ 3y agoReact et al use a virtual DOM, not shadow DOM (unless you specifically render it to shadow DOM). They are a better* way to manipulate DOM in that you no longer need to manipulate the DOM, you just build a function that returns what the DOM should look like and it figures out what transforms need to happen. *They’re pitched as a better way, and I think it’s better, but people can reasonably disagree
- nicoburns 3y agoNot at all. Without React (or a similar framework) you are still left with the options of: - Manually keep track of UI state (which is complex, and often leads to hard to maintain spaghetti code) - Recreate an entire DOM tree every time you re-render (which is slow to the extent that it will often lead to performance problems in practice). Apparently this is not as slow as it used to (so you could probably get away with this sometimes - and you could before), but it's still generally a better idea to use a framework as you get better performance for very low cost. There are plenty of non-React frameworks that will you these benefits too. And many of them are much smaller. I think the reason to use React specifically is more "business reasons" such assurances that the framework will continue to be maintained, library ecosystem, developer pool, etc. Other frameworks are often technically superior, the difference just isn't that great.