MCPcopy Index your code
hub / github.com/kenberkeley/react-demo / constructor

Method constructor

src/components/Msg/MsgForm/index.js:19–29  ·  view source on GitHub ↗
(props, context)

Source from the content-addressed store, hash-verified

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()

Callers

nothing calls this directly

Calls 1

getInitStateFunction · 0.85

Tested by

no test coverage detected