Persistent state management library for React Native, wrapping pub/sub patterns around AsyncStorage-like backends. Current version 3.0.71, active development, with frequent releases. Key differentiators: automatic persistent storage, collection-oriented key design (e.g., report_1234), React hooks (useOnyx) and non-React subscribers (Onyx.connect). Requires idb-keyval, react-native-device-info, react-native-nitro-modules, and react-native-nitro-sqlite as peer dependencies. Ships TypeScript definitions, supports browser bundling via Webpack. Unlike Redux or MobX, Onyx is tailored for React Native's offline-first, persistent-storage needs with minimal boilerplate.
npm install react-native-onyxNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows full Onyx setup: import, init, set, merge, and useOnyx hook in a React component.
npm install react-native-onyx@latest idb-keyval react-native-device-info react-native-nitro-modules react-native-nitro-sqlite
Name non-collection keys without underscore, e.g., 'reportData' instead of 'report_data'
const current = await Onyx.get(KEY); const updated = [...current, newItem]; Onyx.set(KEY, updated);
const value = await Onyx.get(KEY);
Onyx.init({ keys: { ... } });Ensure react-native-onyx is installed: npm install react-native-onyx. For TS, add to tsconfig.json: "moduleResolution": "node" or "bundler"
Use default import: import Onyx from 'react-native-onyx'
Use Onyx.set for primitive values, or wrap in an object: Onyx.merge(KEY, { value: 'string' })Ensure Onyx.init is called before any Onyx.connect, and that the key exists in storage or has been set