Performance: ReactDOM render process
HIGH IMPACT
This affects how fast React updates the UI and how smoothly the page responds to user actions.
function App() { const [count, setCount] = React.useState(0); return <Counter count={count} onClick={() => setCount(c => c + 1)} />; } const root = ReactDOM.createRoot(document.getElementById('root')); root.render(<App />); // React updates only changed components efficiently
ReactDOM.render(<App />, document.getElementById('root')); // Re-render entire app on every small state change outside React's control
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Full ReactDOM.render on every change | Many nodes updated | Multiple reflows per update | High paint cost | [X] Bad |
| React root with selective updates | Minimal nodes updated | Single reflow per update | Low paint cost | [OK] Good |