Reputation: 803
I am having an issue trying to load my application. I am new to React and cannot figure out what the problem is. Below are two console errors I am getting. Can someone lend a hand? I am happy to add code to this post but I am not sure what file you would need to see. I have tried going through many SO posts but a am referencing ReactDOM correctly (case wise) in my code from what the posts say. Thanks for the help!
Failed to load resource: the server responded with a status of 404 (Not Found)
Uncaught ReferenceError: ReactDOM is not defined
at eval (eval at <anonymous> (bundle.js:6797), <anonymous>:85:3)
at Object.<anonymous> (bundle.js:6797)
at __webpack_require__ (bundle.js:20)
at eval (eval at <anonymous> (bundle.js:1151), <anonymous>:21:16)
at Object.<anonymous> (bundle.js:1151)
at __webpack_require__ (bundle.js:20)
at eval (eval at <anonymous> (bundle.js:47), <anonymous>:11:15)
at Object.<anonymous> (bundle.js:47)
at __webpack_require__ (bundle.js:20)
at bundle.js:40
Upvotes: 0
Views: 3528
Reputation: 1
check your version of nodejs, if it is in
version 10 use import ReactDOM from 'react-dom';
if it is in version 8 use const ReactDOM = require ('react-dom');
Upvotes: 0
Reputation: 116
Without knowing your setup it's difficult, but the app is either not importing the react-dom
module, or it's not installed at all.
Are you using a boilerplate?
Check your package.json
.
Is there an entry similar to "react-dom": "^15.5.3"
?
If so, just do an npm install
in that directory.
Now check: does the module in which you'd like to use ReactDOM import react-dom
?
const ReactDOM = require('react-dom');
// OR
import ReactDOM from 'react-dom';
If all this is done, your next step might be to check your webpack build script.
Not much else to say without knowing how you've set up the project.
Cheers.
Upvotes: 4
Reputation: 173
Check your entry file (which should be defined inside your webpack.config.js).
Did your forget to put import ReactDOM from 'react-dom
?
Upvotes: 0