React Router API Reference
    Preparing search index...

    Interface Session<Data, FlashData>

    Session persists data across HTTP requests.

    interface Session<Data = SessionData, FlashData = Data> {
        data: FlashSessionData<Data, FlashData>;
        id: string;
        flash<Key extends string>(name: Key, value: FlashData[Key]): void;
        get<Key extends string>(
            name: Key,
        ):
            | undefined
            | (Key extends keyof Data ? Data[Key<Key>] : undefined)
            | (Key extends keyof FlashData ? FlashData[Key<Key>] : undefined);
        has(name: (keyof FlashData | keyof Data) & string): boolean;
        set<Key extends string>(name: Key, value: Data[Key]): void;
        unset(name: keyof Data & string): void;
    }

    Type Parameters

    Index

    Properties

    Methods

    Properties

    The raw data contained in this session.

    This is useful mostly for SessionStorage internally to access the raw session data to persist.

    id: string

    A unique identifier for this session.

    Note: This will be the empty string for newly created sessions and sessions that are not backed by a database (i.e. cookie-based sessions).

    Methods