UNPKG

@suspensive/react

Version:

Suspensive interfaces for react

31 lines (30 loc) 1.39 kB
import { PropsWithoutChildren } from "./utility-types/PropsWithoutChildren.cjs"; import * as _$react_jsx_runtime0 from "react/jsx-runtime"; import { ComponentProps, ComponentType, SuspenseProps as SuspenseProps$1 } from "react"; //#region src/Suspense.d.ts interface SuspenseProps extends SuspenseProps$1 { /** * With clientOnly prop, `<Suspense/>` will return fallback on the server and children on the client. It uses `useSyncExternalStore` (not `useEffect`) to distinguish server and client via `getServerSnapshot` and `getSnapshot`. * @see https://suspensive.org/docs/react/Suspense#avoid-server-side-rendering-clientonly */ clientOnly?: boolean; } /** * This component is just wrapping React's Suspense. to use Suspense easily in Server-side rendering environment like Next.js * @see {@link https://suspensive.org/docs/react/Suspense Suspensive Docs} */ declare const Suspense: (({ clientOnly, fallback, children, name, ...rest }: SuspenseProps) => _$react_jsx_runtime0.JSX.Element) & { displayName: string; with: <TProps extends ComponentProps<ComponentType> = Record<string, never>>(suspenseProps: PropsWithoutChildren<SuspenseProps>, Component: ComponentType<TProps>) => ((props: TProps) => _$react_jsx_runtime0.JSX.Element) & { displayName: string; }; }; //#endregion export { Suspense, SuspenseProps }; //# sourceMappingURL=Suspense.d.cts.map