UNPKG

@diginet/use-reactive

Version:

A reactive state management hook for React.

21 lines 674 B
import React from "react"; import { S, H, RO } from "./useReactive"; /** * The context object for the reactive store. */ type ReactiveStoreContext<T> = [ state: T, subscribe: S<T>, history: H<T> ]; /** * Creates a globally shared reactive state using React Context and useReactive. * * @param initialState The initial state object * @returns {ReactiveStoreProvider, useReactiveStore} Context provider and hook */ export declare function createReactiveStore<T extends object>(initialState: T, options?: RO<T>): readonly [React.FC<{ children: React.ReactNode; }>, () => ReactiveStoreContext<T>]; export {}; //# sourceMappingURL=useReactiveStore.d.ts.map