React hook for qortex-store with selector support. Concurrent-mode safe and optimized for minimal re-renders.
npm install qortex-store-reactimport { createStore, useStore } from 'qortex-store-react';// Create a store (in a separate file)const counterStore = createStore((set, get) => ({count: 0,increment: () => set({ count: get().count + 1 }),}));// Use in React componentsfunction Counter() {const count = useStore(counterStore, (s) => s.count);const increment = useStore(counterStore, (s) => s.increment);return <button onClick={increment}>Count: {count}</button>;}
Pick only the state slices you need
Fully compatible with React 18+ concurrent features
Re-renders only when selected values change
Bring your own equality function for object selectors
Full generic type inference out of the box
Unsubscribes automatically on unmount
| Parameter | Type | Description |
|---|---|---|
store | Store<T> | A store created with createStore |
selector? | (state: T) => U | Picks a state slice (defaults to identity) |
equalityFn? | (a: U, b: U) => boolean | Custom equality (defaults to Object.is) |
Lightweight and optimized for performance.
0.3KB / 10KB Performance Budget