/** * Options for the useRuvyxaLoader hook. */ export interface UseLoaderOptions { /** If false, the loader will not execute automatically. Default: true. */ enabled?: boolean; /** Dependencies that trigger a refetch when changed. */ deps?: unknown[]; } /** * Result returned by the useRuvyxaLoader hook. */ export interface UseLoaderResult { /** The loaded data, or undefined if still loading or errored. */ data: T | undefined; /** Whether the loader is currently fetching. */ loading: boolean; /** Error thrown by the loader, if any. */ error: Error | undefined; /** Manually trigger a refetch. */ refetch: () => void; } /** * React hook for consuming Ruvyxa loaders on the client side. * * Provides loading, error, and data states with automatic refetch support. * Handles race conditions from stale closures and component unmounting. * * Usage: * ```tsx * function UserProfile({ userId }: { userId: string }) { * const { data, loading, error, refetch } = useRuvyxaLoader( * () => fetch(`/api/users/${userId}`).then(r => r.json()), * { deps: [userId] } * ) * * if (loading) return

Loading...

* if (error) return

Error: {error.message}

* return
{data.name}
* } * ``` */ export declare function useRuvyxaLoader(loader: () => Promise, options?: UseLoaderOptions): UseLoaderResult; //# sourceMappingURL=use-loader.d.ts.map