dev->cdev.ops = &scull_fops
当我打开index.html并且chrome的调试告诉我时,我没有查看任何内容:" 未公开的正则表达式"
答案 0 :(得分:0)
您应该使用react-dom
代替。
ReactDOM.render(<Lamp color="green" />, document.body)
class Lamp extends React.Component {
constructor() {
super()
this.state = {
active: false,
}
this.toggleActive = this.toggleActive.bind(this)
}
toggleActive() {
this.setState({ active: !this.state.active })
}
render() {
return (
<div
style={{ backgroundColor: this.state.active ? 'green' : 'red' }}
>
lampada
<button onClick={this.toggleActive}>on/off</button>
</div>
)
}
}
ReactDOM.render(
<Lamp />,
document.getElementById('root')
)
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
<div id="root"></div>