UNPKG

@rivetkit/react

Version:

React hooks and components for RivetKit client applications

28 lines (25 loc) 1.3 kB
import * as rivetkit_client from 'rivetkit/client'; import { Client, ExtractActorsFromRegistry } from 'rivetkit/client'; export { createClient } from 'rivetkit/client'; import { AnyActorRegistry, CreateRivetKitOptions, ActorOptions } from '@rivetkit/framework-base'; declare function createRivetKit<Registry extends AnyActorRegistry>(client: Client<Registry>, opts?: CreateRivetKitOptions<Registry>): { useActor: <ActorName extends keyof ExtractActorsFromRegistry<Registry>>(opts: ActorOptions<Registry, ActorName>) => { useEvent: (eventName: string, handler: (...args: any[]) => void) => void; error: Error | null; hash: string; isConnected?: boolean | undefined; isConnecting?: boolean | undefined; isError?: boolean | undefined; opts: { name: keyof ExtractActorsFromRegistry<Registry>; key: string | string[]; params?: Record<string, string>; createInRegion?: string; createWithInput?: unknown; enabled?: boolean; }; handle: rivetkit_client.ActorHandle<ExtractActorsFromRegistry<Registry>[ActorName]> | null; connection: rivetkit_client.ActorConn<ExtractActorsFromRegistry<Registry>[ActorName]> | null; }; }; export { createRivetKit };