Skip to main content
import { useStytchMember } from '@stytch/nextjs/b2b';

export const Home = () => {
  const { member, isInitialized } = useStytchMember();

  if (!isInitialized) {
    return <p>Loading...</p>;
  }

  return member ? <p>Welcome, {member.name}</p> : <p>Log in to continue!</p>;
};
{
  "member": { ... },
  "isInitialized": true,
  "fromCache": false
}
To get the currently signed in , use the useStytchMember hook. If the user is not signed in, the member object will be null. In non-React environments, use the self.getSync method to get the Member.

Return Value

member
object | null
The current Member.
fromCache
boolean
Whether the Session data is from persistent storage.