Search code examples
reactjsjsfiddle

I got the error unclosed regular expression in my jsfiddle


I am new to React and jsfiddle. I try to program something basic in React by the JSfiddle but nothing appear on the screen and I get the errors "unclosed regular expression" and "Unrecoverable syntax error". I didnt find any solution or explanation, why these errors appear, not in the web and here. The following is the my jsfiddle: https://jsfiddle.net/eli12m/or9uxwch/38/ Can you please tell me what i am missing. The following is the code:

class InputPhoneNumber extends React.component{
	render(){
  	return(
    );
  }
}


class ReadOnlyPhoneNumber extends React.component{
	render(){
  	return(
    );
  }
}

class PhoneNumberInputDisplay extends React.component{
	render(){
  	return (<h1>Hello World</h1>); /* Here the errors */
  }
}

  ReactDOM.render(
    <PhoneNumberInputDisplay />,
    document.getElementById('root')
  );
<html>
<head>
    <title>Page Title</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
</head>
<body>
  <div class="jumbotron jumbotron-fluid">
    <div id="root" class="container">
    </div>
  </div>
</body>
</html>


Solution

  • Bad synthaxe, you can't write

    return();
    

    And you can't return nothing. Try to use the message outputed by the console to figure out what is wrong before asking :) In chrome, right click anywhere => inspect => console tab