We get this warning as React 18 introduces a new root API
for managing roots.
For instance, this is the code instance in your project which has ReactDOM.render specified.
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
import "./index.css";
ReactDOM.render(<App />, document.getElementById("root"));
To remove this warning, simply follow this:
import React from "react";
import { createRoot } from "react-dom/client";
import App from "./App";
import "./index.css";
const container = document.getElementById("root");
const root = createRoot(container);
root.render(<App />);
Top comments (0)