我正在採取反應。但是我經常不知道錯誤是什麼。下面的代碼沒有正確渲染,並在jsbin的控制檯中顯示沒有錯誤。切換複選框使用反應失敗
const App = React.createClass ({
getInitialState() {
return {checked: false}
},
handleCheck() {
this.setState({checked: !this.state.checked})
},
render() {
return(
<div>
<input type="checkbox" onChange={this.handleCheck} />
<p>This box is {this.state.checked}</p>
</div>
)
}
})
ReactDOM.render(<App />,document.getElementById('app-container'));
https://jsbin.com/dehafizaba/1/edit 需要提醒。
您的jsbin包含與您的代碼不同的代碼。 –