Warning: ReactDOM.render is no longer supported in React 18
I’m getting this error message in my console:
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.
This is my index.js file:
import React from "react"; import ReactDOM from "react-dom"; import App from './components/App'; ReactDOM.render(<App />, document.getElementById('root'));
How do I fix this?
Answer ( 1 )
Instead of this