Hi i would like to ask how can i copy object from react state to another temporary state. I tried it like this:
startEditing() {
this.setState({editMode: true});
//Save schedule before changes
this.setState({oldSchedule: this.state.schedule});
}
cancelEditing(){
this.setState({editMode:false});
//revert changes in schedule
this.setState({schedule:this.state.oldSchedule});
this.setState({oldSchedule:null});
}
I understan't why this no working but don't know how to do this properly. Could you help me please?
Schedule is object type