Every time I refresh the page when I am using a component within the Private Route below, I navigate to the /login. Is there a way to prevent that from happening? I only want to navigate to login if there is no currentUser.
const PrivateRoute = ({ children }) => {
const { currentUser } = useContext(AuthContext);
return currentUser ? children : <Navigate to="/login" />;
};