3 ms·
Maybe I wasn't clear. The big idea is not components. The big idea is expressing your view hierarchy as a single snapshot in time, and when the data changes you
by peterhunt 10y ago
Maybe I wasn't clear. The big idea is not components. The big idea is expressing your view hierarchy as a single snapshot in time, and when the data changes you conceptually throw out the old view hierarchy and re-render from scratch and React manages the native view updates to ensure that it's fast and doesn't adversely affect the UX by, say, resetting scrollbar position.
Contrast this with two previous approaches. The first is where you have a component hierarchy that renders the initial state of the view, but when the data changes you need to write imperative code to transition the native views to reflect the new state. The second is traditional data binding, which doesn't help when you want to change the view hierarchy itself (rather than properties of existing views) based on an underlying data change.