React Hooks: useWarGrid and useGridEvent
Hooks give typed access to the grid API and event subscriptions without manually managing refs. The hooks clean up automatically and keep callbacks fresh without resubscribing.
Planned. This page shows the specification from issue #178. The live example, source for every framework and the API reference replace it when the feature ships.
Live example
A grid plus a separate toolbar component connected through the provider and a selected-count badge.
Expected behavior
The badge updates on selection. Unmounting the toolbar drops the subscription count by its listeners. Handler updates never cause duplicate subscriptions.
Planned API surface
useWarGrid(config)useWarGridApi()useGridEvent(eventName, handler)useGridState(selector)<WarGridProvider>Acceptance criteria
- useGridState re-renders only when the selected slice changes, compared by reference equality (pending)
- useGridEvent keeps exactly one subscription per hook instance across re-renders (pending)
- Hooks used outside the provider throw a descriptive error in development (pending)
- Subscriptions are released on unmount (pending)