?
auth.onAuthStateChanged
Subscribe to auth state; fires immediately with the current user, then on every transition.
auth.onAuthStateChanged(cb) → unsubscribe
Drive UI off this rather than reading currentUser once at render. It fires on verify, logout, and every authStatus change; during a delegated sign-in it may fire null while authenticating. Returns an unsubscribe function.
Parameters
cb
(user: AppUser | null) => void
RequiredCalled with the current user, then on each change.
Usage
import { auth } from '@mindstudio-ai/interface'; useEffect(() => auth.onAuthStateChanged(setUser), []);