https://supertokens.com/ logo
#general
Title
# general
f

Falci

03/26/2022, 9:20 AM
Hello! How can I create a React component that shows a Login or Logout button ?
r

rp

03/26/2022, 9:21 AM
Hey! You mean from a style point of view or functionality?
f

Falci

03/26/2022, 9:22 AM
functionality
r

rp

03/26/2022, 9:23 AM
Which supertokens recipe are you using?
f

Falci

03/26/2022, 9:23 AM
thirdpartyemailpassword
useSessionContext
seems to require
ThirdPartyEmailPasswordAuth
which always redirect the user
The auth wrapper component will redirect only if a session doesn’t exist
f

Falci

03/26/2022, 9:25 AM
how can I know if the current visitor is logged or not?
r

rp

03/26/2022, 9:25 AM
You can pass requireAuth={false} prop to the auth wrapper
f

Falci

03/26/2022, 9:25 AM
ahhh
great
r

rp

03/26/2022, 9:25 AM
And then inside your component, use useSessionContext to check if a session exists or not
f

Falci

03/26/2022, 9:26 AM
perfect, that was the missing piece
it worked
thanks!
r

rp

03/26/2022, 9:29 AM
awesome :))
2 Views