React Linting: Unclosed Regular Expression

谁说我不能喝 提交于 2019-12-08 04:05:14

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/44934444/react-linting-unclosed-regular-expression

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!