mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
Example react-user-management: Unsubscribe onAuthStateChange listener. (#27799)
Example react-user-management: Unsubscribe the sb.auth.onAuthStateChange listener on component cleanup.
This commit is contained in:
1 parent
282bd2c73f
commit
33a6bd439a
1 file changed
+3
-1
@@ -12,9 +12,11 @@ function App() {
|
||||
setSession(session)
|
||||
})
|
||||
|
||||
supabase.auth.onAuthStateChange((_event, session) => {
|
||||
const { data } = supabase.auth.onAuthStateChange((_event, session) => {
|
||||
setSession(session)
|
||||
})
|
||||
|
||||
return () => data.subscription.unsubscribe();
|
||||
}, [])
|
||||
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user