React Router API Reference
    Preparing search index...

    Interface SessionStorage<Data, FlashData>

    SessionStorage stores session data between HTTP requests and knows how to parse and create cookies.

    A SessionStorage creates Session objects using a Cookie header as input. Then, later it generates the Set-Cookie header to be used in the response.

    interface SessionStorage<Data = SessionData, FlashData = Data> {
        commitSession: (
            session: Session<Data, FlashData>,
            options?: CookieSerializeOptions,
        ) => Promise<string>;
        destroySession: (
            session: Session<Data, FlashData>,
            options?: CookieSerializeOptions,
        ) => Promise<string>;
        getSession: (
            cookieHeader?: null | string,
            options?: CookieParseOptions,
        ) => Promise<Session<Data, FlashData>>;
    }

    Type Parameters

    Index

    Properties

    commitSession: (
        session: Session<Data, FlashData>,
        options?: CookieSerializeOptions,
    ) => Promise<string>

    Stores all data in the Session and returns the Set-Cookie header to be used in the HTTP response.

    destroySession: (
        session: Session<Data, FlashData>,
        options?: CookieSerializeOptions,
    ) => Promise<string>

    Deletes all data associated with the Session and returns the Set-Cookie header to be used in the HTTP response.

    getSession: (
        cookieHeader?: null | string,
        options?: CookieParseOptions,
    ) => Promise<Session<Data, FlashData>>

    Parses a Cookie header from a HTTP request and returns the associated Session. If there is no session associated with the cookie, this will return a new Session with no data.