React hooks for qortex-store with selector support. Optimized for minimal re-renders and developer ergonomics with createUseStore.
npm install qortex-store-reactimport { createStore, createUseStore } from 'qortex-store-react';// 1. Create a storeconst counterStore = createStore((set, get) => ({count: 0,increment: () => set({ count: get().count + 1 }),}));// 2. Create a specialized hook (Recommended)export const useCounter = createUseStore(counterStore);// 3. Use in React componentsfunction Counter() {const count = useCounter((s) => s.count);const increment = useCounter((s) => s.increment);return <button onClick={increment}>Count: {count}</button>;}
Pick only the state slices you need
Fully compatible with React 18+ concurrent features
Create specialized hooks with createUseStore for better ergonomics
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