Search code examples
javascriptreactjscodepen

React syntax error doesn't seem to be showing up in codepen


I am learning React Tutorial(tic-tac-toe game). Here is my code in codepen. This code have bug at line 21, there is no commma after 'squares: squares'. But syntax error doesn't seem to be showing up. Where does the error information appear?

  handleClick(i) {
    const squares = this.state.squares.slice();
    squares[i] = this.state.xIsNext ? 'X' : 'O';
    this.setState({
      squares: squares  //no commma
      xIsNext: !this.state.xIsNext,
    });
  }

Solution

  • I suppose Codepen is processed error in specific way depend on parser that you use. And probably they have issues with handling errors from Babel.

    Like in your example if you are switching JS parser (Babel) to Typescript, Codepen will process this error and shows in the editor right bottom corner notification (!).