score:6

Accepted answer

The error comes from this line: return <h1>React App</h1>, because <h1>...</h1> is not valid javascript. Even if rename this is would be parsed as vanilla js and not jsx, because of your webpack-config.js, so there are multiple things you should do to fix it:

  1. Rename App.js to App.jsx,
  2. Update test: /\.js$/, to test: /\.(js|jsx)$/, in webpack-config.js
  3. I think there is also an error in your .babelrc: you don't want that .js there, after "transform-class-properties".
  4. Rename webpack-config.js to webpack.config.js

Here is a tutorial that shows this: https://www.valentinog.com/blog/babel/. Also, you could use https://github.com/facebook/create-react-app that simplifies all of this and provides a great starting config.


Related Query

More Query from same tag