reactjscodepen

React Linting: Unclosed Regular Expression


I'm working through the React Tutorial using Codepen. I have the react libraries inlcuded in script tags and have selected the Babel preprocessor but I get a linting error at the JSX closing tag:

render() {
  return (
    <button className="square" onClick={() => this.props.onClick()}>
      {this.props.value}
    </button> // Error here
  );
}

The error is for an unclosed regular expression.

When I check the Codepen for the tutorial itself, it returns the same error but the pen functions. Mine doesn't. Other React pens on the site also return the error but work.

My pen is here. I haven't been able to find any typos in my code.

What am I missing?


Solution

  • Remove extra curly braces at the end @line 30 in js file from 'handleClick()' function. After removing this extra brace your code is working fine.