Console is throwing Unterminated JSX contents error [closed]

I am trying to set up a basic react example using jspm/systemjs and babel. I have this code here to show a simple page and am getting an error

import React from 'react'; export default React.createClass({ displayName: 'MainComponent', propTypes: { item: React.PropTypes.object }, render: function render() { return ( <div> <div>; ); } }); React.render(<MainComponent />, document.getElementById('app')) 

Nothing is showing up, the console is throwing "Unterminated JSX contents", and babel is pointing to the react.render line:

 17 | React.render(<MainComponent />, document.getElementById('app')) | ^ 
0

2 Answers

You have 2 unclosed <div> tags in your render() and a semicolon that probably doesn't belong. I'd get rid of those (e.g. close them, delete the semicolon in <div>; if it doesn't belong) and try it again.

3

Give / in closing div element and remove semicolon(;) after div element.

import React from 'react'; export default React.createClass({ displayName: 'MainComponent', propTypes: { item: React.PropTypes.object }, render: function render() { return ( <div> </div> ); } }); React.render(<MainComponent />, document.getElementById('app')) 
0

You Might Also Like