Support
Quality
Security
License
Reuse
Coming Soon for all Libraries!
Currently covering the most popular Java, JavaScript and Python libraries. See a SAMPLE HERE.
kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
Set up a modern web app by running one command.
Quick Overview
npx create-react-app my-app
cd my-app
npm start
QUESTION
Deprecation notice: ReactDOM.render is no longer supported in React 18
Asked 2022-Apr-05 at 08:50I get this error every time I create a new React App and I don't know how to fix it:
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
I created my react app using: npx create-react-app my-app
ANSWER
Answered 2022-Apr-05 at 08:44In your file index.js, change to:
import React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";
import App from "./App";
import reportWebVitals from "./reportWebVitals";
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
reportWebVitals();
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
No vulnerabilities reported
Explore Related Topics