UNPKG

react-when-ready

Version:

React tools for content readiness orchestration. Provides context providers, hooks and components to coordinate smooth transitions when async content becomes available

28 lines (27 loc) 897 B
import React from "react"; interface Props { /** Child elements that can report their readiness */ children: React.ReactNode; /** * Callback invoked when all child consumers (and the provider itself) * have reported readiness. Called only once. */ onReady?: () => void; } /** * Provider for managing readiness state of nested components. * * How it works: * 1. Registers all child components using the readiness context * 2. Tracks their readiness status via onReady() calls * 3. Transitions to "ready" state when: * - At least one child component reported readiness * - All registered components have completed their work * * Features: * - Supports nesting: can itself be a context consumer * - Guarantees single onReady invocation * - Optional onReady prop callback */ export declare const ReadinessPendingProvider: React.FC<Props>; export {};