react-native-storage: two funding packages are its only runtime dependencies, and one runs on install
local storage wrapper for both react-native and browser. Support size controlling, auto expiring, remote data auto syncing and getting batch data in one query.
At a glance
- What is it?
- A local storage wrapper for native and web builds, with a capacity cap, expiry, per-key remote sync and batch loading. Underneath that is an unusually small dependency graph: nothing that helps with storage at all, two packages that exist to ask for money, and a test suite that runs against a mock of the very backend the library wraps.
- Who is it for?
- Read the second paragraph before you adopt this. The author recommends a different library for new work and says it is cleaner and more powerful, which makes this a maintenance-mode dependency rather than a choice.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 126 days ago.
- What is it written in?
- Mainly JavaScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 22, 2026, and from our analysis. They are not legal advice.
Star history
- sunnylqm/react-native-storage3,031 ★ · -5
| Repository | 2026-09-24 | 2026-11-22 |
|---|---|---|
| sunnylqm/react-native-storage | 3k | 3k |
-5 Stars in the last 59 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
The README recommends a different library, in its second paragraph
The second paragraph of the file is an argument against the project it belongs to. It says that for a more modern and unified approach to requests, caching and persistent storage, the author recommends a specific data-fetching library together with its async storage persister, and calls that combination cleaner, more elegant and more powerful. That is the maintainer's own view, stated plainly, and it is more useful than a deprecation notice because it names the replacement and a reason. The consequence for a reader is that this library is in maintenance rather than in development, with a version number of one point zero point one, no tagged releases at all, and a last commit about two and a half months old. That is a reasonable thing to keep in a codebase. It is not a reasonable thing to start a new feature on without reading that paragraph.
The dependency graph contains nothing that helps with storage
The manifest has a dependency block with exactly two entries, and both are funding platform tooling:
"dependencies": {
"opencollective-postinstall": "^2.0.2",
"opencollective": "^1.0.3"
}The library's actual behaviour delegates to whatever storage backend you pass in, which is why there is nothing here to wrap. But the two that are present are not inert. One of them is named for a postinstall hook, and the scripts block wires it to the install lifecycle:
"postinstall": "opencollective-postinstall"So installing this package executes a script from a funding tool on every install, in exchange for displaying a funding message. That is a widely used convention across the ecosystem and it is not malicious, but it is a real consideration for a library whose purpose is to hold local data, and it is invisible unless you read the manifest.
No storage backend is selected by default, and the consequence is silent data loss
The constructor takes a backend, and the documentation for that option states the failure mode plainly:
// Use AsyncStorage for RN apps, or window.localStorage for web apps.
// If storageBackend is not set, data will be lost after reload.
storageBackend: AsyncStorage, // for web: window.localStorageData lost after reload, with no error and no warning, is the default outcome of constructing the object and forgetting one property. That is a design choice rather than a defect, and it keeps the library free of a platform import so the same code runs in both environments, but it means the first thing a new integration has to verify is that a write actually survives, rather than assuming that a successful save means a successful save. The rest of the constructor is a capacity cap of a thousand identifiers by default, and an expiry default of one day expressed in milliseconds, with null documented as meaning never expires.
A key may not contain a low line character, and no reason is given
The save example carries an inline warning on the key property itself:
key: 'loginState', // Note: Do not use underscore("_") in key!No further explanation appears anywhere in the file. That constraint is worth understanding rather than obeying, because it suggests the key is being used to build a composite identifier rather than as an opaque label, which is exactly the kind of design where a separator inside the value collides with a separator in the structure. The readme tells you not to, and does not say why, and the load example that would show the key being parsed is cut off after a comment. For a library that stores application state, a reserved character in the key space is a constraint an integrator discovers by hitting it, not by reading ahead.
Batch loading comes in two flavours with different server requirements
The batch API has two methods and the difference is not cosmetic. One takes an array of load descriptors, invokes the sync method for each key in turn when data is missing, and resolves once they are all done, returning the results in order. The other collects the missing identifiers into a single array and calls one sync method with the whole array, which reduces the number of requests. The cost is on the server: the readme says you need to implement an array query and handle the parameters properly, and notes that the identifier parameter can be either one string or an array of strings. Each entry also carries a per-item background setting, documented as defaulting to true, where a timeout returns whatever the current value is, and setting it to false waits for the sync to finish instead.
The tests run against a mock of the backend they wrap
The test configuration sets a setup file that loads a mock storage implementation before anything else runs:
"setupFiles": [
"./jestSupport/mockStorage.js"
]So the suite that is supposed to prove the wrapper works does its work against a stand-in for both platform backends, not against either of them. That is the normal trade for a library with platform dependencies and it keeps the tests fast and deterministic, but it means the suite cannot catch a mismatch between the wrapper's call shape and a real backend's actual behaviour, which is exactly where this kind of abstraction fails. Two other settings are worth noting: the runner is set to stop at the first failing suite rather than reporting everything, and it runs in verbose mode. The test directory is at the top level rather than beside the source.
The only build badge points at a service that stopped taking new projects
There is one badge in the readme and it links to the older domain of a hosted continuous integration service, and the top level listing contains that service's configuration file. That combination is worth noticing because the test script is not wired to it: the script is a plain test runner invocation, and the build is a bundle step driven by a rollup configuration at the root. So the badge advertises a hosted pipeline whose configuration is committed, while the actual verification someone would run locally is a different command. For a project in maintenance that nobody expects to add to a hosted pipeline, it is a small piece of bookkeeping nobody has swept up, and it is also the first thing a reader sees when they open the file.
Native consumers get the source tree, web consumers get the built bundle
The manifest declares three entry points rather than one. The main field points at a built file, two module fields point at a built file in a different module format, and the native field points at a file inside the source directory:
"main": "lib/storage.cjs.js",
"jsnext:main": "lib/storage.esm.js",
"module": "lib/storage.esm.js",
"react-native": "src/storage.js",So a web bundler consumes the rolled-up output while a native bundler is handed the original source and does the transformation itself. That is a common arrangement for libraries that must not be transpiled twice, and it means the published tarball has to contain both, which is why the file list includes the built directory and the source directory rather than only the former. The build itself cleans the output directory with a shell removal command, runs the bundler, and then copies the type declarations across by hand, which is why the published types come from the source tree rather than from anything the bundler emits.
Editorial conclusion
Read the second paragraph before you adopt this. The author recommends a different library for new work and says it is cleaner and more powerful, which makes this a maintenance-mode dependency rather than a choice. If you are keeping it, two things are worth knowing. The backend is not set by default and the documented consequence of leaving it unset is silent data loss after a reload. And keys may not contain a low line character, with no reason given, so a naming convention you already use may not port over unchanged.
Frequently asked questions
What does sunnylqm/react-native-storage do?
It is a local storage wrapper for both native apps, using the platform's async storage, and web apps, using browser local storage. It adds a capacity cap on stored identifiers, per-entry expiry, remote sync keyed by name, and batch loading in one call.
Should I use react-native-storage for new work?
The README's own second paragraph recommends against it. It points to a data-fetching library with its async storage persister as a more modern and unified approach, calling that combination cleaner and more powerful.
What happens if I do not set a storage backend?
The constructor documents the consequence directly: if the backend is not set, data will be lost after reload. The option is where you pass the native async storage module, or the browser's local storage for web.
What are react-native-storage's runtime dependencies?
Two, both from a funding platform: a postinstall helper that prints a funding message and the funding client itself. Neither is used for storage, and the postinstall helper runs as a script when the package is installed.
What is the difference between the two batch loading methods?
One invokes a separate sync method per key, in turn, whenever data is missing. The other collects the missing identifiers into an array and passes them to a single sync method, which reduces the request count but requires the server to implement an array query. Each entry can also set a background flag, which by default returns the current value if the sync times out rather than waiting for it.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/sunnylqm-react-native-storage)Star history chart for your README
[](https://hysenlabs.com/projects/sunnylqm-react-native-storage)Was this useful?