I am using React and ReactDOM of version 16.0.0 and react-addons-perf 15.4.2 that is latest version. But i am gating this compile time error.
./node_modules/react-addons-perf/index.js Module not found: Can't resolve 'react-dom/lib/ReactPerf' in '....\node_modules\react-addons-perf'
To solve the error "Module not found: Error: Can't resolve 'react-dom'", make sure to install the react-dom package by opening your terminal in your project's root directory and running the command npm install react-dom react and restart your development server. Copied!
To solve the "Module not found: Can't resolve" error in React, make sure to install the package from the error message if it's a third-party package, e.g. npm i somePackage . If you got the error when importing local files, correct your import path.
import React from 'react'; import ReactDOM from 'react-dom'; import { createRoot } from 'react-dom/client'; import Switch from './components/Switch'; const root = ReactDOM. createRoot(document. getElementById('root')); root. render( <React.
To check which React version is your project using you need to open the package. json. Take a look under the dependencies section. It should list all of the dependencies of your project and one of those should be React.
To follow up on what Rei Dien said, the React 16 announcement mentions the following:
react-addons-perf no longer works at all in React 16. It’s likely that we’ll release a new version of this tool in the future. In the meantime, you can use your browser’s performance tools to profile React components.
To put it simply, just npm uninstall react-addons-perf
and everything should be fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With