I get this error every time I create a new React App and I don’t know how to fit it. Can anybody help me, please?
Error:
react-dom.development.js:86 Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot
EDIT: I created my react app using: npx create-react-app my-app
>Solution :
In your file index.js change to:
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(<App />);