react-elegant-ui
Version:
Elegant UI components, made by BEM best practices for react
23 lines (22 loc) • 1 kB
TypeScript
import React, { FC } from 'react';
import { SimpleEventChannel } from '../lib/SimpleEventChannel';
export declare const SSRContext: React.Context<boolean>;
export declare const SSREventManagerContext: React.Context<SimpleEventChannel<boolean> | null>;
/**
* Component which provide SSR context and force re-render on client side
*
* This behavior is required to first render on client will match with SSR structure
* It may be useful for SEO purposes or graceful degradation to no-js level
*
* This component must be used on top level of application, and preferred only once
*/
export declare const SSRProvider: FC;
/**
* Hook to render content depends on render context (SSR/CSR)
*
* It will always return `false` on SSR and while first render on CSR,
* but will `true` when all child nodes of `SSRProvider` will rendered on client side
*
* This hook should be used with `SSRProvider` parent, otherwise it will return `true` always
*/
export declare const useIsReadyToCSR: () => boolean;