sewitch prev state in reactjs code example
Example: prevstate in react
handleClick() {
this.setState(prevState => {
return {
count: prevState.count + 1
}
})
}
handleClick() {
this.setState(prevState => {
return {
count: prevState.count + 1
}
})
}