constructor(props, context) {
super(props);
this.state = {
ShowVoucher: false
}
I want to change state of showVoucher. without Re-Render of component. i have tried like this
componentDidUpdate(prevState) {
if(prevState.showVoucher!= this.state.showVoucher){
this.setState({ ShowVoucher: false})
}
}
But my code stucks in infinite loop. How can i solve it? Any other solutions are welcome.
componentDidUpdateto prevent from memory leak