class is the ES6 way of writing. getIntialState is an ES5 hook function and cannot be used here.
Define the initial state should be in the constructor: constructor(props){
super(props); this.state={ ss:"xxx" }
}
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
this.handlechange
constructor(props) { super(props) this.handleChange = this.handleChange.bind(this) }
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}`
class is the ES6 way of writing.
getIntialState is an ES5 hook function and cannot be used here.
Define the initial state should be in the constructor:
constructor(props){
}
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
If you don’t want to use constructor, define state directly and write directly in class from
`
class... {
state = {
}
// this.state can be obtained
}
`