我想大声告诉你2017-05-19 10:31:18
class is the ES6 way of writing.
getIntialState is an ES5 hook function and cannot be used here.
大家讲道理2017-05-19 10:31:18
Define the initial state should be in the constructor:
constructor(props){
super(props);
this.state={
ss:"xxx"
}
}
迷茫2017-05-19 10:31:18
I feel like there is something wrong with what is written here. This method needs to be bound in the constructor, otherwise this method should not be found if this is lost? this.handlechange
constructor(props) {
super(props)
this.handleChange = this.handleChange.bind(this)
}
阿神2017-05-19 10:31:18
If you don’t want to use constructor, define state directly and write directly in class from
`
class... {
state = {
sss
}
// this.state can be obtained
}
`