3 ms·
>For some reason, people consider that model to be more hip than the normal one where you take care of updating yourself. A huge benefit of the virtual dom mod
by AgentME 8y ago
>For some reason, people consider that model to be more hip than the normal one where you take care of updating yourself.
A huge benefit of the virtual dom model as used in React is that you don't need to have separate code paths for the initial render of a widget and updating part of a widget. I can't count the number of times I've seen pre-React widgets coded to assume most attributes would never change, had bugs in updating some uncommonly-updated attributes, or gave up on having separate initial-render/update code paths by throwing away the widget's entire DOM and re-rendering on most attribute changes. With the React way, there's one code path for initial render and updating, so it doesn't take any special effort to make every attribute efficiently update-able. A whole category of bugs disappeared in codebases I've worked on that adapted React.