Answer a question

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 class="builder-conteiner">

        <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'))
    |                               ^ 

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.

Logo

React社区为您提供最前沿的新闻资讯和知识内容

更多推荐