Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/christianbaroni/stores/llms.txt

Use this file to discover all available pages before exploring further.

@storesjs/stores is a single package that ships three runtime builds — React web, React Native, and vanilla TypeScript — selected automatically via package conditions. Install it once and import from the same specifier regardless of your target environment.

Install

npm install @storesjs/stores
@storesjs/stores requires Node.js ≥20. Check your local version with node --version before installing.

Peer Dependencies

All peer dependencies are optional — install only the ones your target environment requires:
PackageVersionWhen required
react>=18.0.0React web apps
react-native>=0.69.0React Native apps
react-native-mmkv>=2.0.0Persistent storage in React Native
Install the ones you need alongside the package:
npm install @storesjs/stores react react-dom

Runtime Modes

@storesjs/stores exports different builds depending on the active package condition. The correct build is selected automatically in most toolchains.
The default build. Import from @storesjs/stores in any React web project — no configuration needed:
import {
  createBaseStore,
  createDerivedStore,
  createQueryStore,
  configureStores,
} from '@storesjs/stores';
Stores are callable as React hooks in this build:
// Inside a React component
const currency = settingsStore(s => s.currency);
Compatible with React ≥18. Works with Vite, Next.js, Create React App, and any bundler that resolves exports.

Chrome Extension Plugin

A separate entry point ships a ChromeStorageAdapter for persisting store state in Chrome extension storage. Import it from the /chrome subpath:
import { ChromeStorageAdapter } from '@storesjs/stores/chrome';
Pass the adapter to configureStores() as your storage backend before creating any stores:
import { configureStores } from '@storesjs/stores';
import { ChromeStorageAdapter } from '@storesjs/stores/chrome';

configureStores({
  storage: new ChromeStorageAdapter(),
  storageKeyPrefix: 'myextension:',
});
The /chrome entry resolves its own types, import, and require conditions independently of the main entry point — it is always the web build, regardless of other active conditions.
The @types/chrome types package is required in your project for the ChromeStorageAdapter import to type-check correctly. Add it as a dev dependency: npm install -D @types/chrome.

Build docs developers (and LLMs) love