UNPKG

react-intlayer

Version:

Easily internationalize i18n your React applications with type-safe multilingual content management.

33 lines (31 loc) 848 B
import { FC, PropsWithChildren, ReactNode } from "react"; //#region src/server/serverContext.d.ts declare const createServerContext: <T>(defaultValue?: T) => ServerContext<T>; /** * Fetches a value present in a given server context. * Attempts to closely mimic the `useContext` API. * * @example * getServerContext(IntlayerServer); */ declare const getServerContext: <T>({ _storage, _defaultValue }: ServerContext<T>) => T; type ServerContext<T> = FC<PropsWithChildren<{ value?: T; }>> & { Provider: FC<PropsWithChildren<{ value?: T; }>>; Consumer: FC<PropsWithChildren<{ children: (context: T | undefined) => ReactNode; }>>; _storage: () => { value: T | undefined; }; _defaultValue: T | undefined; }; //#endregion export { createServerContext, getServerContext }; //# sourceMappingURL=serverContext.d.ts.map