Returns current Session data.
This signature supports React Suspense.
function Page() {
const { data } = useSession({ suspense: true });
switch (data.type) {
case SessionType.Anonymous:
// data is a AnonymousSession
return <Login />;
case SessionType.JustWallet:
// data is a WalletOnlySession
return <MyWallet address={data.address} />;
case SessionType.WithProfile:
// data is a ProfileSession
return <MyProfile profile={data.profile} />;
default:
return <p>Something went wrong.</p>;
}
}
Further session data updates will NOT trigger a suspense.
Returns current Session data.
Use this hook to determine if the user is authenticated or not.