.aaa {
width: 200px;
height: 200px;
background: red;
}
class A extends React.Component {
constructor() {
super()
this.state = {
aaa: 111
}
}
click() {
console.log('click')
this.setState({
aaa: this.state.aaa + 1
})
}
componentDidMount() {
console.log('componentDidMount')
this.click()
}
componentDidUpdate() {
console.log('componentDidUpdate')
}
render() {
return React.createElement('div', {
id: 'id',
style: {
height: this.state.aaa
},
onClick: this.click.bind(this),
className: 'aaa'
}, this.state.aaa)
}
}
var a
window.onload = function () {
a = React.render(, document.body)
console.log(a)
}
你如果将babel改成国内的
变成
什么react, react-dom, redux, react-redux都可以在 http://www.bootcdn.cn/ 上找到