0
votes
<html>
<head></head>
<body>
    <div id='app'></div>
<script src="bundle.js"></script>
</body>
</html>

and my index.js === bundle.js(webpack)

import React from 'react';
import ReactDOM from 'react-dom';

ReactDOM.render(
  <h1>Hello, world!</h1>,
  document.getElementById('root')
);

I got an error in console

ERROR in ./~/react-dom/index.js Module not found: Error: Cannot
resolve module 'react/lib/ReactDOM' in
E:\react_redux\react-redux\node_modules\react-dom @
./~/react-dom/index.js 3:17-46

and my package.json

"react": "^15.5.4",
"react-dom": "15.0.2",
1
If you are new and haven't seen it, maybe try create-react-app to to see proper setup of a react app and have a nice starting point. - xDreamCoding
thanku boss and i will try that. - Rajan Lagah

1 Answers

0
votes

You request react of at least version 15.5.4, and react-dom of exactly version 15.0.2. They will not work with each other.

"react": "^15.5.4", 
"react-dom": "15.0.2",

Request react-dom version matching react version:

"react": "^15.5.4", 
"react-dom": "^15.5.4",