I have an authentication system in which the user logins and if authenticated then redirect user to home page... it is working fine but the only problem is that it is giving me
if this a react app you are building, you call ajax request in componentDidMount lifecycle method.
first set your private var
_isMounted=false
Then in componentDidMount:
componentDidMount() {
this._isMounted = true;
.... your ajax request here
}
in your ajax success function:
if (this._isMounted) {
this.setState({ isLoading: false });
}
then in componentWillUnmount lifecycle method:
componentWillUnmount(){
this._isMounted= false
}