After installing 'npm install -g create-react-app' with npm, the project folder was created with 'create-react-app./example'.
We used 'npm start' to run it in developer mode inside the project that was created later.
For a simple example of 'Hello World' output in 'App.js', the following code is entered, but the following compilation error occurs:
ReactDOM.render(
<h1>Hello, World!</h1>,
document.getElementById('root')
);
The errors are as follows:
'Failed to Compile - ./src/App.js ReactDOM is not defined'
react
at the top
Add import ReactDOM from 'react-dom';
© 2024 OneMinuteCode. All rights reserved.