33 ms·
React reduces manual interaction with DOM (which is slow) by calculating the diff between your new render call and the previous one. Imagine building a webapp w
by chenglou 13y ago
React reduces manual interaction with DOM (which is slow) by calculating the diff between your new render call and the previous one. Imagine building a webapp where each time you need to update the view, you just lazily refresh the whole UI. The library knows to only update the necessary parts.
In fact, the whole api is so simple that I could probably summarize the core for you:
- a `render` method that defines what the view looks like, using variables and such.
- a `setState({variableName, newValue})` call, upon which the render method is called again, but only making DOM modifications where your variable influenced them.