Skip to main content
import { View, Text } from 'react-native';
import { useStytchMemberSession } from '@stytch/react-native/b2b';

export const SessionInfo = () => {
  const { session } = useStytchMemberSession();

  return session ? (
    <View>
      <Text>Session ID: {session.member_session_id}</Text>
      <Text>Expires: {new Date(session.expires_at).toLocaleString()}</Text>
    </View>
  ) : (
    <Text>No active session</Text>
  );
};
To get the active session of the currently signed in , use the useStytchMemberSession hook. If the user is not signed in, the returned value will be null. In non-React environments, use the session.getSync method to get the Session.

Return Value

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