I want to get the user on page load i am doing ``...
# help
y
I want to get the user on page load i am doing
Copy code
ts
useEffect(() => {
   const user = supabase.auth.user();
},[])
but it returns null even tho their is a user logged in i have to use
setTimeout()
and sometimes that doesn't work too
n
Hello @yxsh! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
🆕 How to get logged in user on page load
g
Add onAuthStateChange handler and use the signin event to start things. https://supabase.com/docs/reference/javascript/auth-onauthstatechange
n
How to get logged in user on page load
y
Thanks it works :)
n
Thread was archived by @yxsh. Anyone can send a message to unarchive it.