@suspensive/react
Version:
Suspensive interfaces for react
26 lines (25 loc) • 1.09 kB
text/typescript
import { PropsWithoutChildren } from "./utility-types/PropsWithoutChildren.mjs";
import { ComponentProps, ComponentType, ReactNode } from "react";
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
//#region src/ClientOnly.d.ts
interface ClientOnlyProps {
children: ReactNode;
fallback?: ReactNode;
}
/**
* This component ensures its children are only rendered on the client-side.
* @see {@link https://suspensive.org/docs/react/ClientOnly Suspensive Docs}
* @see {@link https://suspensive.org/docs/react/useIsClient useIsClient} is used internally for environment detection
*/
declare const ClientOnly: (({
children,
fallback
}: ClientOnlyProps) => _$react_jsx_runtime0.JSX.Element) & {
displayName: string;
with: <TProps extends ComponentProps<ComponentType> = Record<string, never>>(clientOnlyProps: PropsWithoutChildren<ClientOnlyProps>, Component: ComponentType<TProps>) => ((props: TProps) => _$react_jsx_runtime0.JSX.Element) & {
displayName: string;
};
};
//#endregion
export { ClientOnly, ClientOnlyProps };
//# sourceMappingURL=ClientOnly.d.mts.map