What does React.render do
- First, validate the inputs
- If there was no previous component, render as a new component
- Otherwise, compare the next component to the previous component using “shouldCUpdateComponent”
- If “shouldUpdateComponent” is true, update the component using ReactComponent.updateComponent. Otherwise, unmount and continue to render as a new component
React.render
gives you a declarative way to use React’s update flow at the top level, similar to how re-rendering works inside a component. Many times, however, you can create a wrapper component so that you only have a single React.render
call. This allows you to keep the logic inside components, which may be cleaner.