{"id":21707296,"url":"https://github.com/yasser-g/react-native-redux","last_synced_at":"2025-07-21T22:33:38.579Z","repository":{"id":46819156,"uuid":"231095217","full_name":"Yasser-G/react-native-redux","owner":"Yasser-G","description":"React Native Redux","archived":false,"fork":false,"pushed_at":"2023-10-30T07:06:56.000Z","size":226,"stargazers_count":13,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-19T04:38:47.351Z","etag":null,"topics":["react","react-hooks","react-native","react-redux","reactjs","redux","redux-actions","redux-persist","redux-store","redux-thunk"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Yasser-G.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-31T13:41:10.000Z","updated_at":"2024-12-05T08:07:27.000Z","dependencies_parsed_at":"2023-10-30T09:34:13.394Z","dependency_job_id":null,"html_url":"https://github.com/Yasser-G/react-native-redux","commit_stats":{"total_commits":19,"total_committers":4,"mean_commits":4.75,"dds":0.1578947368421053,"last_synced_commit":"0d178944ddb23daf1b8a01c7ff166b70087cfcc4"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Yasser-G/react-native-redux","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yasser-G%2Freact-native-redux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yasser-G%2Freact-native-redux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yasser-G%2Freact-native-redux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yasser-G%2Freact-native-redux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yasser-G","download_url":"https://codeload.github.com/Yasser-G/react-native-redux/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yasser-G%2Freact-native-redux/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266393154,"owners_count":23922316,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react","react-hooks","react-native","react-redux","reactjs","redux","redux-actions","redux-persist","redux-store","redux-thunk"],"created_at":"2024-11-25T22:16:50.909Z","updated_at":"2025-07-21T22:33:38.556Z","avatar_url":"https://github.com/Yasser-G.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Native Redux \n![npm][npmDownloads] ![PRsBadge] ![npm][npmLicense] ![npm][npmVersion]\n\n### Implement react redux into your app in just One Step!\n\n- No Store configuration needed!\n- No MiddleWares needed, no more dispatch complications.\n- No Reducers or *ACTIONS* required.\n- No Persistance configuration needed, All data are persisted!\n- Very simple way to change store state, just like Component setState !\n- Simply connect your components with simpler connect function\n- Easily use hooks for your functional component, Dive deep in state up to 5 levels!.\n- Built on redux, react-redux and redux-persist, No previous experience needed.\n###### Note that this lib was known before as [Step React Redux][StepReactRedux].\n\n\n\n\n\n\n\n\n## Instalation \n\n\n- Install \u0026 Link [React Native Async Storage][asyncstorage]   **// SKIP this step if already using react-native async storage**\n\n\t\n\n- Then install React Native Redux\n\n\t`npm i react-native-redux`  **- OR -**  `yarn add react-native-redux`\n\n\n\n\n## Usage\n\n### **Provider**\n###### Props\n```ts\ninitialState: object?\nloading: JSX.Element?\n```\n###### Usage\n```ts\nimport React from \"react\"\nimport { Provider } from \"react-native-redux\"\nimport AppContainer from \"../navigation\" // Path to Root Navigation\n\n\nconst myInitialState = { /* your initial state */ }\n/*\n Important Note: state will initialize for first time only,\n then you have to use xSetState or setStateForKey to change it,\n If you want to reinitialize state, you have to call xResetState once.\n See xResetState below\n*/\n\nexport default ()=\u003e (\n  \u003cProvider \n   initialState={myInitialState} \n   loading={/* your loading UI*/}\n  \u003e\n    \u003cAppContainer /\u003e\n  \u003c/Provider\u003e\n)\n```\n\n\n---\n\n\n\n### **connect**\n###### Arguments\n```ts\nWrappedComponent: Component\nrequiredKeys: string[]?\n```\n###### Usage\n \n```ts\nimport React from \"react\"\nimport { connect } from \"react-native-redux\"\n\nclass UserPage extend React.Component {\n  // Your Component goes here\n}\n\n// this will connect all your store to UserPage component props\nexport default connect(UserPage) \n\n/*\n OR you can choose what keys this component using by providing requiredKeys argument\n NOTE: Make sure that your requiredKeys values are already initiated.\n*/ \n\nexport default connect(UserPage, [\"user\", \"someKey\", \"anotherKey\"])\n\n\n// You can also connect to deep state ( Up to 5 levels ) using dotted key. \nexport default connect(UserPage, [\"user.name\"])\n// a prop with key \"user_name\" will be connected\n\n// You can change deepKeyReplacer as a third optional argument\nexport default connect(UserPage, [\"user.name\"], \"-\")\n// a prop with key \"user-name\" will be connected\n\n\n\n```\n\n\n---\n\n\n\n### **xSetState**\n###### Arguments\n```ts\nstate: object\n```\n###### Usage\n\n```ts\nimport { xSetState } from \"react-native-redux\"\n\n// Anywhere in your code\n\nxSetState({ user: { id: 1, name: \"Some Name\" } })\n// console logs =\u003e ReactNativeRedux.user, { id: 1, name: \"Some Name\" }\n// Now all your connected components will have \"user\" prop\n\n\n// Usage with API\n\nasync getMyData(){\n\n    xSetState({ isFetching: true })\n\n    try {\n\n      const response = await fetch(\"http://www.myServer.com/api/myData\")\n      const responseJson = await response.json()\n      xSetState({ isFetching: false, myData: responseJson  })\n\n    } catch (error) {\n\n      alert(error.message)\n\n      // Remeber that You can use xSetState ANYWHERE! as much as you want !\n      xSetState({ isFetching: false })\n    }\n\n}\n```\n\n\n---\n\n\n### **setStateForKey**\n###### Arguments\n```ts\nkey: string\nstate: object\n```\n###### Usage\n\n```ts\nimport { setStateForKey } from \"react-native-redux\"\n\n// Similar to xSetState\n// plus it can be used to set deep state up to 3 levels\n\nsetStateForKey(\"user\", { id: 1, name: \"Some Name\" })\n\n// console logs =\u003e ReactNativeRedux.user, { id: 1, name: \"Some Name\" }\n// Now all your connected components will have \"user\" prop\n\n// Usage to set deep state\n\nsetStateForKey(\"user.name\", \"New Name\" )\n\n// console logs =\u003e ReactNativeRedux.user.name, \"New Name\"\n// Remeber that You can use setStateForKey ANYWHERE!\n```\n\n\n\n---\n\n\n### **getStateForKey**\n###### Arguments\n```ts\nkey: string\n```\n###### Usage\n\n```ts\nimport { getStateForKey } from \"react-native-redux\"\n\n// Similar to setStateForKey\n// but it can be used to get state and deep state\n\nconst userData = getStateForKey(\"user\") \nconsole.log(userData) // =\u003e { id: 1, name: \"Some Name\" }\n\nconst userName = getStateForKey(\"user.name\") \nconsole.log(userName) // =\u003e \"Some Name\"\n\n// getting state for unknown key will return null\nconst someValue = getStateForKey(\"someKey\") \nconsole.log(someValue) // =\u003e null\n\nconst anotherValue = getStateForKey(\"anotherKey.subKey\") \nconsole.log(anotherValue) // =\u003e null\n\n\n// You may add fallback value as second optional argument\n/// default fallback is null\nconst undefinedValue = getStateForKey(\"somekey.subKey.subsubkey\",\"Hello World\") \nconsole.log(anotherValue) // =\u003e  Hello World\n\n// Remeber that You can use getStateForKey ANYWHERE!\n```\n\n### **useStateX** (Hook)\n\n##### You may like to try our new set of hooks [React Stateful Function][ReactStatefulFunction].\n###### Usage\n \n```ts\nimport React from \"react\"\nimport { useStateX } from \"react-native-redux\"\n\n// Hooks Are used inside functional components\n\nconst MyComponent = (props) =\u003e {\n\n\t// Depth: 2 levels\n\tconst isLoggedIn = useStateX(\"user.loggedIn\")\n\t\n\t// Depth: 3 levels\n\tconst userName = isLoggedIn ? useStateX(\"user.data.name\") : \"Guest\"\n\t\n  // NOTE THAT DEPTH TREE SHOULD BE INITIALIZED BEFORE HOOKING IT\n  \n  // You may add fallback value as second optional argument\n  // default fallback is null\n  const undefinedValue = getStateForKey(\"somekey.subKey.subsubkey\",\"Hello World\") \n  console.log(anotherValue) // =\u003e  Hello World\n\t\n\treturn (\n\t\t\u003c\u003e\n\t\t// Your Component goes here\n\t\t\u003cText\u003eName: {userName}\u003c/Text\u003e\n\t\t\u003c/\u003e\n\t)\n\t\n  \n}\n\nexport default MyComponent\n\n```\n\n\n---\n\n### **xResetState** (Dev Only)\n\n###### Usage\n \n```ts\nimport React from \"react\"\nimport { xResetState } from \"react-native-redux\"\n\n/*\nTop level index in your code, call this method once during your develeopment process\nto allow you to reinitialize your state again from Provider initialState prop\n*/\n\n// Call this Once, Then Don't forget to remove it.\n\nxResetState()\n\n\n```\n\n\n\n[asyncstorage]: https://github.com/react-native-community/async-storage#install\n[StepReactRedux]: https://github.com/Yasser-G/step-react-redux\n[ReactStatefulFunction]: https://github.com/Yasser-G/React-Stateful-Function\n[npmDownloads]: \u003chttps://img.shields.io/npm/dt/react-native-redux?label=Installs\u0026logo=npm\u0026style=plastic\u003e\n[npmLicense]: \u003chttps://img.shields.io/npm/l/react-native-redux?label=License\u0026style=plastic\u003e\n[npmVersion]: \u003chttps://img.shields.io/npm/v/react-native-redux?label=Latest%20Version\u0026style=plastic\u003e\n[PRsBadge]: \u003chttps://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=plastic\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyasser-g%2Freact-native-redux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyasser-g%2Freact-native-redux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyasser-g%2Freact-native-redux/lists"}