The worm The worm - 5 months ago 27
React JSX Question

React error even though syntax is correct

I have removed all my code down to the point I just have this:

export class DateApp extends React.Component {
render() {
return (
<div className="dateApp">
<h1> Comments </h1>
export default DateApp;

I get this error on this line:

Module build failed: SyntaxError: Unexpected token

point to the
on the first

I thought it may be a syntax error in one of my functions but as I have removed them all it cant be that.
I have babel, react all installed etc.


If you're using babel to transpile to code:

In the root of your project change the .babelrc file to include the react preset:

  "presets": [

Install the babel react preset using NPM:

npm install --save-dev babel-preset-react