Session
react-router

Session interface

Session persists data across HTTP requests.

Properties

data

Type: Partial<Data & { [Key in string | number | symbol]: FlashData[Key] }>

The raw data contained in this session.

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

id

Type: 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

flash

Type: flash<Key>(name, value): void

get

Type: get<Key>(name): undefined | Key ? keyof Data : undefined | Key ? keyof FlashData : undefined

has

Type: has(name): boolean

set

Type: set<Key>(name, value): void

unset

Type: unset(name): void

Docs and examples CC 4.0