私はReactJsを初めて使っています。私は愚かな問題を抱えていますが、理由はわかりません。 マイトレーニングコード:ReactJs - SyntaxError:埋め込み:終了していないJSXの内容
var ListComponent = React.createClass({
render: function() {
return (
<li>{this.props.value}</li>
);
}
});
var TodoComponent = React.createClass({
getInitialState: function() {
return {
listPoints: []
}
},
addListPoint: function(event) {
if (event.target.value !== '') {
this.setState({
listPoints: this.state.listPoints.push(event.target.value)
});
}
},
render: function() {
var listPoints = [];
for (var i=0; i<this.state.listPoints.length; i++) {
listPoints.push(
<ListComponent>{this.state.listPoints[i]}<ListComponent/>
);
}
return (
<ul>{listPoints}</ul>
<input type="text" onBlur={this.addListPoint}/>
);
},
});
React.render(
<TodoComponent />,
document.getElementById('container')
);
そして、私のトレースバック:
Uncaught SyntaxError: embedded: Unterminated JSX contents (42:21)
40 |
41 | React.render(
> 42 | <TodoComponent />,
| ^
43 | document.getElementById('container')
44 |);
45 |
すべてのタグが閉じられているようです。誰かが私に問題が始まった場所を指摘していますか?
どのようにJSXをJSに変換していますか? Webpack + babel? – Tom