Hi! I'm using react-token-auth and I'm noticing something odd. First, here's my code for createAuthProvider
export const {useAuth, authFetch, login, logout} = createAuthProvider({
accessTokenKey: 'access_token',
onUpdateToken: (token) => fetch(
`${process.env.REACT_APP_URL_BACKEND}/refresh`,
{
method: 'POST',
body: token.access_token
}).then(r => r.json())
});
And here's my simple App() component:
function App() {
const navigate = useNavigate();
const [isSignedIn] = useAuth();
console.log('App isSignedIn: ', isSignedIn)
}
When I access the page, isSignedIn is logged as false and then without refreshing the page, is logged again as true:
App isSignedIn: false [App.js:33]
App isSignedIn: true [App.js:33]
Why is the value of isSignedIn changing without me navigating around the page? I thought this might be due to React StrictMode but I have that disabled.
Hi! I'm using
react-token-authand I'm noticing something odd. First, here's my code forcreateAuthProviderAnd here's my simple
App()component:When I access the page,
isSignedInis logged as false and then without refreshing the page, is logged again as true:Why is the value of
isSignedInchanging without me navigating around the page? I thought this might be due to React StrictMode but I have that disabled.