ReactDom is undefined

Yaniv Efraim picture Yaniv Efraim · Apr 12, 2016 · Viewed 30.2k times · Source

I am using React with Webpack and Babel. I am getting a runtime error:

Uncaught ReferenceError: ReactDom is not defined

My react version is:

"devDependencies": {
   "phantomjs-polyfill": "0.0.2",
   "react-addons-test-utils": "^0.14.8"
 },    
 "dependencies": {
   "react": "^0.14.7",
   "react-dom": "^0.14.7"
 },

and my code is:

import React from 'react';
import ReactDOM from 'react-dom';
import Main from './components/main';

ReactDom.render(<Main />, document.getElementById('root'));

What am I doing wrong?

Answer

Oleksandr T. picture Oleksandr T. · Apr 12, 2016

You have ReactDOM but you don't have ReactDom(case sensitive)

ReactDOM.render(<Main />, document.getElementById('root'));