Registry / storage / reactant-storage

reactant-storage

JSON →
library0.150.0jsnpmunverified

Reactant Storage is a persistence storage plugin for Reactant, a state management library for React. Current stable version is 0.150.0. It integrates with redux-persist to provide automatic state persistence and rehydration for Reactant modules. Released as part of the Reactant monorepo, it follows the same release cadence as other Reactant packages. Key differentiators: seamless integration with Reactant's module system, TypeScript support, and compatibility with React 16-18.

npm install reactant-storage
INSTALL
IMPORT
SIG · REACTANT-STORAGE
R
reactant-storage
storagejavascriptv0.150.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

storage
import { storage } from 'reactant-storage'
const storage = require('reactant-storage')
ESM-only; CommonJS require is not supported.
createStorage
import { createStorage } from 'reactant-storage'
import createStorage from 'reactant-storage'
createStorage is a named export, not a default export.
StorageOptions
import type { StorageOptions } from 'reactant-storage'
import { StorageOptions } from 'reactant-storage'
StorageOptions is a TypeScript type, use import type.

Shows basic setup of reactant-storage with redux-persist, including creating a persisted reducer and wrapping the app with PersistGate.

import { storage, createStorage } from 'reactant-storage'; import { createStore, combineReducers } from 'redux'; import { persistReducer, persistStore } from 'redux-persist'; import { Provider } from 'react-redux'; import { PersistGate } from 'redux-persist/integration/react'; const persistConfig = { key: 'root', storage, }; const rootReducer = combineReducers({ // your reducers }); const persistedReducer = persistReducer(persistConfig, rootReducer); const store = createStore(persistedReducer); const persistor = persistStore(store); const App = () => ( <Provider store={store}> <PersistGate loading={null} persistor={persistor}> {/* your app */} </PersistGate> </Provider> ); // Alternatively, use createStorage() const myStorage = createStorage({ blacklist: ['temporary'] });
Debug
Known issues
gotchaThe storage key must be unique per store.
fix
Use a unique key for each persistConfig to avoid conflicts.
affects: >=0.0.0
gotchaDo not use both storage and createStorage simultaneously with different configs.
fix
Choose one method: import storage for simple default, or createStorage with custom options.
affects: >=0.0.0
deprecatedUsage with Reactant's old module API may be deprecated; check Reactant documentation.
fix
Upgrade to latest reactant-storage and follow Reactant v0.150+ migration guide.
affects: <=0.149.0
Errors
Common errors & fixes
TypeError: Cannot destructure property 'storage' of 'reactant_storage' as it is undefined.
CommonJS require used instead of ESM import.
fix
Change to: import { storage } from 'reactant-storage';
Module not found: Can't resolve 'redux-persist' in '...'
Missing peer dependency redux-persist.
fix
Run: npm install redux-persist
Warning: Each child in a list should have a unique "key" prop.
Using storage without persistConfig key.
fix
Ensure persistConfig includes a key (e.g., key: 'root').
Upgrade
Version history
0.150.0latest on npm
Audit
Dependencies
reactrequiredPeer dependency required for React runtime.
react-reduxrequiredPeer dependency required for Redux integration with React.
reactant-modulerequiredPeer dependency required for Reactant module system.
reduxrequiredPeer dependency required for Redux store.
redux-persistrequiredPeer dependency required for persistence functionality.
Agent activity
19 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
reactant-storage — npm install reactant-storage · libregistry