react-router-theme
Version:
Theme support for React Router and Remix
20 lines (19 loc) • 734 B
TypeScript
/**
* See Readme: https://www.npmjs.com/package/react-router-theme
*/
export declare const useTheme: (loaderData: any, fetcher: any, defaultTheme?: string) => readonly [string, (theme: string) => void];
/**
* @param req incoming request in loader
* @returns the value of the theme cookie if found, otherwise NULL
*/
export declare const getThemeFromCookie: (req: Request) => string | null;
export declare const createThemeCookie: (formData: FormData) => string;
export declare const loader: (args: {
request: Request;
}) => Promise<{
theme: string | null;
}>;
export declare const action: (args: {
request: Request;
}) => Promise<Response>;
export declare const themeCookieResponse: (formData: FormData) => Response;