when use prevstate react code example
Example: prevstate in react
handleClick() {
this.setState(prevState => {
return {
count: prevState.count + 1
}
})
}
handleClick() {
this.setState(prevState => {
return {
count: prevState.count + 1
}
})
}