I have a problem understanding how to store userinfo or even a boolean isUserLoggedIn in react context. I’ve heard that its the best way to store them.
So I have an auth page, which on a successful auth response from backend creates “is_authed=true” Cookie, and ideally i want to store another isAuthed indicator in React.Context. But the problem is, i also have an axios interceptor, which listens to error codes and once one of the responses returns 401 or 403, i want to delete the “is_authed=true” cookie (which is easy) and change the “isAhuthorized” context value to false. But i’ve read that you can’t access context outside of components and in my case in axios interceptor. So whats the best approach here? Would be nice if someone could link a comprehensive guide on how this whole process should be organized (i know there are a lot of “react auth” guides but none of what i watched had the functionality of saving is authed state in context and then changing it from axios interceptors )