UNPKG

miniplex-react

Version:

React glue for Miniplex.

12 lines (11 loc) 556 B
import { Bucket } from "miniplex"; /** * Subscribes to changes in the specified bucket, and re-renders the component * whenever entities are added to or removed from it. * * @param bucket The bucket to watch for changes * @returns The bucket passed in, for convenience */ export declare function useEntities<T extends Bucket<any>>(bucket: T): T; export declare function useOnEntityAdded<E>(bucket: Bucket<E>, callback: (entity: E) => void): void; export declare function useOnEntityRemoved<E>(bucket: Bucket<E>, callback: (entity: E) => void): void;