useAuthStateChange

Receive a notification every time an auth event happens. Composed in the useAuth recipe.

import { useAuthStateChange } from 'react-supabase'
function Page() {
useAuthStateChange((event, session) => {
console.log(`Supabase auth event: ${event}`, session)
})
return ...
}

Note: Auth listener is automatically cleaned up during the hook’s cleanup phase.