Well, I am trying to set the state of my App.js Component in the login.js component to true. The code I have in my App.js is this:
state = {
isAuth: false
};
And this is how I try to set the isAuth to false in my login.js Component:
statusCode:{
200: function(){
this.App.state.isAuth = true;
console.log('it's working!')
}
}
This is how I import the App Component:
import App from './App';
If the user successfully login the status code should be 200 and after receiving this status code the isAuth of the App.js component should be set to true. Don't know why this is not working. I'm getting the error TypeError: Cannot read property 'state' of undefined.