Back to Home
qortex-store-react
React State Hooks

qortex-store-react

React hook for qortex-store with selector support. Concurrent-mode safe and optimized for minimal re-renders.

npm install qortex-store-react

Quick Start

import { 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 components
function Counter() {
const count = useStore(counterStore, (s) => s.count);
const increment = useStore(counterStore, (s) => s.increment);
return <button onClick={increment}>Count: {count}</button>;
}

Features

Selector Support

Pick only the state slices you need

Concurrent Safe

Fully compatible with React 18+ concurrent features

Minimal Re-renders

Re-renders only when selected values change

Custom Equality

Bring your own equality function for object selectors

TypeScript First

Full generic type inference out of the box

Auto Cleanup

Unsubscribes automatically on unmount

API Reference

ParameterTypeDescription
storeStore<T>A store created with createStore
selector?(state: T) => UPicks a state slice (defaults to identity)
equalityFn?(a: U, b: U) => booleanCustom equality (defaults to Object.is)

Tiny Bundle Size

Lightweight and optimized for performance.

~0.3KBmin + gzip

0.3KB / 10KB Performance Budget

Minified Size0.8KB
Dependencies1
Tree Shaking
Supported

Ready to get started?

npm install qortex-store-react

Back to Home