Good afternoon I'm using React with Node. Using ro...
# support-questions
m
Good afternoon I'm using React with Node. Using routes within react. I'm using the docs on the link below to set up a check so that on the base root of the website (/) you see a different page depending on whether you're logged in or not. Problem is that I don't want to wrap all my routes in
<EmailPasswordAuth requireAuth={false}>
but if I don't use this tag on App (where the routes are) then
useSessionContext()
always reports false. Where am I going wrong? https://supertokens.com/docs/emailpassword/common-customizations/sessions/checking-session-front-end
r
Hey!
m
Hi there again @rp !
r
So in order to use the session context function, you need to wrap your component with the auth wrapper
If you don’t want to do that, any other way to know if a user is logged in is to use await Session.doesSessionExist()
m
Let me give that a shot now 👍
r
But u will have to use it in a useEffect or something
Cause u need to await it
m
Good point
hmm
I'm having real trouble getting this to work
I tried to copy the video from the docs, but I'm just getting a ton of errors in the console about not using useEffect proerly
r
Oh right yea. You should google how to use async functions in useEffect