ServerSsrContext
import { ServerSsrContext } from '@dr.pogodin/react-utils';
The ServerSsrContext class extends SsrContext class from the React Global State library; it is used by React Utils server() factory as a part of SSR setup.
Generic Parameters
StateT
— The type of global state object.
Properties
-
chunkGroups
— ChunkGroupsT -
chunks
— string[] — Defaults empty array. -
redirectTo
— string | undefined — Undefined by default; if it is set by the app during SSR, the server will trigger redirect to this URL, instead of serving the generated HTML markup. Note, it will usestatus
property (below) to set the redirect code, thus it also should be set to appropriate code to perform a redirect. -
req
— Request — ExpressJS request being handled. -
status
— number — HTTP status for the response. Defaults 200 (OK).
Methods
constructor()
constructor(req: Request, chunkGroups: ChunkGroupsT, initialState?: StateT)
Creates a new ServerSsrContext instance.
Arguments
res
— RequestchunkGroups
— ChunkGroupsTinitialState
— StateT — Optional. Initial global state value.