UNPKG

@jvanderen1/unstated-next

Version:

Up-to-date version of everyone's favorite state management library unstated-next

15 lines (14 loc) 488 B
import { ReactNode, ComponentType } from "react"; interface ContainerProviderProps<State = void> { initialState?: State; children: ReactNode; } interface Container<V, S = void> { Provider: ComponentType<ContainerProviderProps<S>>; useContext: () => V; } interface ContainerOptions { displayName?: string; } type UseHook<V, S> = (initialState?: S) => V; export function createContainer<V, S = void>(useHook: UseHook<V, S>, options?: ContainerOptions): Container<V, S>;