How do i get the previous state value of the checkbox in class based component

Viewed 20

I have a scenario where I need to check the previous state of the checkbox with the new value of the checkbox say at first-time checkbox is checked and I will save it on edit i will uncheck this but the save button is not getting enabled because the state is getting updated to uncheck(false) value i need to compare the old value with new value

state = {
status: false,
}

handleChange = (event) => {
this.setState((prevState) => {
return {
  ...prevState,
  status: !prevState.status
}
})
}
0 Answers
Related