(props, context)
| 17 | } |
| 18 | |
| 19 | constructor (props, context) { |
| 20 | // 既然用到了 context,显然需要 super 一下咯 |
| 21 | // 实际上最完善的形式的确就是如下写法 |
| 22 | super(props, context) |
| 23 | |
| 24 | // 初始 state 必须定义,否则会报错 |
| 25 | // 就像在 Vue 中需要在 data 中定义默认值 |
| 26 | this.state = getInitState() |
| 27 | |
| 28 | this.handleChange = handleChange.bind(this) // mixin |
| 29 | } |
| 30 | |
| 31 | componentDidMount() { |
| 32 | this.updateState() |
nothing calls this directly
no test coverage detected