ReactDom is undefined
There is a minor error in your code you have written ReactDom instead of ReactDOM. The correct code should be given below :
import React from 'react';
import ReactDOM from 'react-dom';
import Main from './components/main';
ReactDOM.render(<Main />, document.getElementById('root'));
You have ReactDOM
but you don't have ReactDom
(case sensitive)
ReactDOM.render(<Main />, document.getElementById('root'));
ReactDOM
!= ReactDom
. There are two things you can do to fix this.
import React from 'react';
import ReactDOM from 'react-dom'; // you used 'react-dom' as 'ReactDOM'
import Main from './components/main';
ReactDom.render(<Main />, document.getElementById('root')); // you referred to it as 'ReactDom' which is wrong.
Becasue ReactDOM
!= ReactDom
. So you need to fix one of those places so that both places have the same name with the same case.
The recommended fix would be,
import React from 'react';
import ReactDOM from 'react-dom'; // this is recommended
import Main from './components/main';
ReactDOM.render(<Main />, document.getElementById('root'));
Or you can do,
import React from 'react';
import ReactDom from 'react-dom';
import Main from './components/main';
ReactDom.render(<Main />, document.getElementById('root'));