setstate function in react native code example
Example 1: this.setstate is not a function in react native
constructor(props) {
super(props)
this.onClick = this.onClick.bind(this)
}
onClick () {
this.setState({...})
}
Example 2: react native setstate object
this.setState({
lang1:{
...this.state.lang1,
name: "myExample"
}
})