authenticated routes
My setup
My react Context gets the state for whether the user is authenticated or not by making an api call to
/user and if the response is valid and the user details are fetched successfully, it stores that state in the context as user. This is the state I am using to validate whether the user is logged in or not. Question
Given my auth state depends on the user state that is going to be fetched, I don't want the check in
beforeLoad to happen before that fetch and setting of state is complete. My current code is as follows but even if the user is logged in, it goes to login.The logic of the behavior makes sense but what is the recommended way to handle the
isLoading state in such a setup?