So here is what my code looks like
---------index.js-----
var React =require(\'react\');
var ReactDOM =require(\'react-dom\');
var App=require(\'../compo
In the file index.js
, you should change your code like this:
var App = require('../components/App').default;
or use import
import App from '../components/App';
I recommend using a unified usage. You can import/export
or module.exports/require
.
You're mixing up require
, and import
/ export
.
Since you're running webpack, all of your React code (and anything that gets transpiled by babel via webpack) should stick to using import/export. require
should only be used in places like js that's directly run by node.
In your index.js, change all the requires to imports and see if that helps.