I have Switch toggle Btn which has each Alert Modal when it toggle. Alert Modal works well but Switch mode keeps show on 'true', when I toggled it 'false' and Re-render app. How can I save last state of Switch Value? This is what I got.
Here , if switch switch value is off the you have to set both toggleOff , ToggleOn ,take reference of below code :
toggleSwitch(){
this.setState({switchValue : !this.state.switchValue})
if(this.state.switchValue){
this.setState({toggleOff: true , toggleOn : false})
} else if(!this.state.switchValue){
this.setState({toggleOn : true , toggleOff : false})
}
}