ReactDOM.createRoot().render(...)?Letβs say:
const element = <h1>Hello, React</h1>;
ReactDOM.createRoot(document.getElementById("root")).render(element);
| Step | What Happens Internally |
|---|---|
| 1οΈβ£ | JSX gets converted to a ReactElement (a plain JS object) |
| 2οΈβ£ | ReactDOM.createRoot() prepares a place in the DOM |
| 3οΈβ£ | .render() tells React to reconcile the ReactElement with the real DOM |
| 4οΈβ£ | React uses Fiber architecture to build a Fiber Tree |
| 5οΈβ£ | React performs Reconciliation: compares new tree with old |
| 6οΈβ£ | React applies minimal changes to the DOM (via Virtual DOM) |
const el = <h1>Hello</h1>
Becomes:
const el = {
type: "h1",
props: {
children: "Hello"
}
}
This is not DOM β just a JS object React understands.
Fiber = React's engine to manage: