{"library":"react-native-onyx","title":"react-native-onyx","description":"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.","language":"javascript","status":"active","last_verified":"Fri May 01","install":{"commands":["npm install react-native-onyx"],"cli":null},"imports":["import Onyx from 'react-native-onyx'","import { useOnyx } from 'react-native-onyx'","import Onyx from 'react-native-onyx'; Onyx.connect({key: 'foo', callback: ...})"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import Onyx from 'react-native-onyx';\nimport { useOnyx } from 'react-native-onyx';\n\n// Define keys\nconst ONYXKEYS = {\n    SESSION: 'session',\n    COLLECTION: { REPORT: 'report_' },\n};\n\n// Initialization\nOnyx.init({ keys: ONYXKEYS });\n\n// Setting data\nOnyx.set(ONYXKEYS.SESSION, { token: 'abc123' });\n\n// Merging data\nOnyx.merge(ONYXKEYS.SESSION, { email: 'user@example.com' });\n\n// In a React component\nfunction SessionInfo() {\n    const [session] = useOnyx(ONYXKEYS.SESSION);\n    return <Text>{session?.email}</Text>;\n}","lang":"typescript","description":"Shows full Onyx setup: import, init, set, merge, and useOnyx hook in a React component.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}