Registry / storage / redux-persist-sqlite-storage

redux-persist-sqlite-storage

JSON →
library1.0.4jsnpmunverified

A redux-persist storage adaptor backed by SQLite via react-native-sqlite-storage. Version 1.0.4, no active release cadence (last update 2019). Key differentiator: drop-in replacement for AsyncStorage in React Native, compatible with redux-persist 4.x and 5.x. Provides getItem, setItem, removeItem, getAllKeys, clear methods with Promise and callback support.

npm install redux-persist-sqlite-storage
INSTALL
IMPORT
SIG · REDUX-PERSIST-SQLI
R
redux-persist-sqlite-storage
storagejavascriptv1.0.4
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.

SQLiteStorage (default export)
✓ import SQLiteStorage from 'redux-persist-sqlite-storage'
✗ import { SQLiteStorage } from 'redux-persist-sqlite-storage'
The package exports a factory function as default export; named import will fail.
SQLiteStorage (CommonJS require)
✓ const SQLiteStorage = require('redux-persist-sqlite-storage').default
✗ const SQLiteStorage = require('redux-persist-sqlite-storage')
When using CommonJS, .default is required because the package uses ES module export.
Calling the factory
✓ const storeEngine = SQLiteStorage(SQLite, { name: 'my-db', location: 'default' })
✗ const storeEngine = SQLiteStorage(SQLite)
Second argument (config object) is optional, but omitting it uses defaults. Must pass react-native-sqlite-storage's SQLite object.

Sets up redux-persist with SQLite storage using react-native-sqlite-storage. Shows configuration and integration.

import SQLite from 'react-native-sqlite-storage'; import SQLiteStorage from 'redux-persist-sqlite-storage'; import { persistStore, persistReducer } from 'redux-persist'; import { createStore } from 'redux'; const config = { name: 'myReduxDB', location: 'default' }; const storeEngine = SQLiteStorage(SQLite, config); const persistConfig = { key: 'root', storage: storeEngine }; const rootReducer = (state = { count: 0 }, action) => { switch (action.type) { case 'INCREMENT': return { ...state, count: state.count + 1 }; default: return state; } }; const persistedReducer = persistReducer(persistConfig, rootReducer); const store = createStore(persistedReducer); const persistor = persistStore(store); export { store, persistor };
Debug
Known issues
breakingThe factory function must be called with SQLite instance from react-native-sqlite-storage; passing null or wrong object will cause runtime errors.
fix
Ensure you import SQLite from 'react-native-sqlite-storage' and pass it as first argument.
affects: >=1.0.0
breakingOnly compatible with redux-persist 4.x and 5.x. Version 6+ uses a different storage interface.
fix
Use redux-persist@5.9.1 or lower; or migrate to redux-persist@6 with a custom storage adaptor.
affects: >=1.0.0
deprecatedThe package is unmaintained since 2019 and may have unfixed bugs and compatibility issues with newer React Native versions.
fix
Consider alternatives like redux-persist-expo-file-system or custom AsyncStorage adaptor.
affects: >=1.0.0
gotchaThe getAllKeys method returns keys as string array; empty database returns empty array, not null.
fix
Always handle array results; check if (keys.length) before iterating.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: _reduxPersistSqliteStorage2.default is not a function
Using CommonJS require without .default; package uses ES module export.
fix
Use require('redux-persist-sqlite-storage').default
SQLiteStorage is not a function
Named import used instead of default import.
fix
Use import SQLiteStorage from 'redux-persist-sqlite-storage'
Cannot read property 'getItem' of undefined
Missing or incorrect SQLite instance passed to factory.
fix
Ensure you import SQLite from 'react-native-sqlite-storage' and pass it correctly.
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies
react-native-sqlite-storagerequiredRequired peer dependency; the adaptor wraps its SQLite instance.
redux-persistrequiredRequired to integrate with the redux-persist ecosystem.
Agent activity
23 hits · last 30 days
node
20
Amazon
1
Resources
redux-persist-sqlite-storage — npm install redux-persist-sqlite-storage · libregistry