UNPKG

@mitcsutt/kiln-dnd

Version:

Kiln drag and drop: sortable lists, boards, drop zones and grid layouts with one keyboard model and one announcer, rendered through kiln-ui

13 lines (12 loc) • 553 B
/** A minimal external store: components subscribe to the slice they draw. */ export interface Store<T> { get: () => T; set: (patch: Partial<T>) => void; subscribe: (listener: () => void) => () => void; } export declare function createStore<T extends object>(initial: T): Store<T>; /** * The part of a store's state a component reads. Return a primitive (or a stable value) * from `select`, so a component re-renders only when its own slice changes. */ export declare function useStore<T, S>(store: Store<T>, select: (state: T) => S): S;