# createRoot

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);
1
2
3
4
5
6

# createRoot 初始化方法

src/react/packages/react-dom/src/client/ReactDOM.js

# createContainer 初始化 fiber

src/react/packages/react-reconciler/src/ReactFiberReconciler.new.js

# createFiberRoot

src/react/packages/react-reconciler/src/ReactFiberRoot.new.js

Last Updated: 2/3/2023, 7:32:33 PM