@suspensive/react
Version:
Suspensive interfaces for react
47 lines (46 loc) • 2.08 kB
text/typescript
import { PropsWithoutChildren } from "./utility-types/PropsWithoutChildren.cjs";
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
import * as _$react from "react";
import { ComponentProps, ComponentType, PropsWithChildren, ReactNode } from "react";
//#region src/ErrorBoundaryGroup.d.ts
declare const ErrorBoundaryGroupContext: _$react.Context<{
reset: () => void;
resetKey: number;
} | undefined>;
interface ErrorBoundaryGroupProps extends PropsWithChildren {
/**
* If you use blockOutside as true, ErrorBoundaryGroup will protect multiple ErrorBoundaries as its children from external ErrorBoundaryGroup's resetKey
* @default false
*/
blockOutside?: boolean;
}
/**
* ErrorBoundaryGroup is a wrapper component that allows you to manage multiple ErrorBoundaries easily.
* ErrorBoundaries as children of nested ErrorBoundaryGroup will also be reset by parent ErrorBoundaryGroup.Consumer.
* @see {@link https://suspensive.org/docs/react/ErrorBoundaryGroup Suspensive Docs}
*/
declare const ErrorBoundaryGroup: (({
blockOutside,
children
}: ErrorBoundaryGroupProps) => _$react_jsx_runtime0.JSX.Element) & {
displayName: string;
with: <TProps extends ComponentProps<ComponentType> = Record<string, never>>(errorBoundaryGroupProps: PropsWithoutChildren<ErrorBoundaryGroupProps>, Component: ComponentType<TProps>) => ((props: TProps) => _$react_jsx_runtime0.JSX.Element) & {
displayName: string;
};
Consumer: ({
children
}: {
children: (errorBoundaryGroup: ReturnType<typeof useErrorBoundaryGroup>) => ReactNode;
}) => _$react_jsx_runtime0.JSX.Element;
};
/**
* This hook provides the reset method for the ErrorBoundaryGroup.
* Must be used within an ErrorBoundaryGroup component.
* @see {@link https://suspensive.org/docs/react/ErrorBoundaryGroup#useerrorboundarygroup Suspensive Docs}
*/
declare const useErrorBoundaryGroup: () => {
reset: () => void;
};
//#endregion
export { ErrorBoundaryGroup, ErrorBoundaryGroupContext, ErrorBoundaryGroupProps, useErrorBoundaryGroup };
//# sourceMappingURL=ErrorBoundaryGroup.d.cts.map