{"id":21707297,"url":"https://github.com/yasser-g/step-react-redux","last_synced_at":"2026-04-09T09:52:07.988Z","repository":{"id":57370790,"uuid":"204479734","full_name":"Yasser-G/step-react-redux","owner":"Yasser-G","description":"Implement React-Redux into your app in just One Step!","archived":false,"fork":false,"pushed_at":"2020-03-11T10:02:57.000Z","size":50,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-24T23:02:50.814Z","etag":null,"topics":["react","react-native","react-redux","reactjs","redux","redux-persist"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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}},"created_at":"2019-08-26T13:17:46.000Z","updated_at":"2020-03-11T10:02:59.000Z","dependencies_parsed_at":"2022-09-05T07:30:13.095Z","dependency_job_id":null,"html_url":"https://github.com/Yasser-G/step-react-redux","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yasser-G%2Fstep-react-redux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yasser-G%2Fstep-react-redux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yasser-G%2Fstep-react-redux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yasser-G%2Fstep-react-redux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yasser-G","download_url":"https://codeload.github.com/Yasser-G/step-react-redux/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244656734,"owners_count":20488641,"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","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-native","react-redux","reactjs","redux","redux-persist"],"created_at":"2024-11-25T22:16:52.081Z","updated_at":"2025-12-31T00:05:20.720Z","avatar_url":"https://github.com/Yasser-G.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BREAKING CHANGE\n\n#### Now react-native users should use [React Native Redux][ReactNativeRedux] instead.\n---\n\n\n\n\n# Step React Redux \n![npm][npmDownloads] ![PRsBadge] ![npm][npmLicense] ![npm][npmVersion]\n\n### Implement React-Redux into your react web 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\n\n\n\n\n\n\n\n## Instalation \n\n\n`npm i step-react-redux`  **- OR -**  `yarn add step-react-redux`\n\n###  ***Then.. Your Are Done !*** \n\n\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 ReactDOM from \"react-dom\"\n\nimport { Provider } from \"step-react-redux\"\n\nimport App from \"./App\"\n\nconst rootElement = document.getElementById(\"root\")\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\nReactDOM.render(\n  \u003cProvider \n   initialState={myInitialState} \n   loading={/* your loading UI*/}\n  \u003e\n    \u003cApp /\u003e\n  \u003c/Provider\u003e,\n  rootElement\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 \"step-react-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 \"step-react-redux\"\n\n// Anywhere in your code\n\nxSetState({ user: { id: 1, name: \"Some Name\" } })\n// console logs =\u003e StepReactRedux.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 \"step-react-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 StepReactRedux.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 StepReactRedux.user.name, \"New Name\"\n\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 \"step-react-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// 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 \"step-react-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\t// NOTE THAT DEPTH TREE SHOULD BE INITIALIZED BEFORE HOOKING IT\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 \"step-react-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\n\n[ReactStatefulFunction]: https://github.com/Yasser-G/React-Stateful-Function\n[ReactNativeRedux]: https://github.com/Yasser-G/react-native-redux\n[npmDownloads]: \u003chttps://img.shields.io/npm/dt/step-react-redux?label=Installs\u0026logo=npm\u0026style=plastic\u003e\n[npmLicense]: \u003chttps://img.shields.io/npm/l/step-react-redux?label=License\u0026style=plastic\u003e\n[npmVersion]: \u003chttps://img.shields.io/npm/v/step-react-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%2Fstep-react-redux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyasser-g%2Fstep-react-redux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyasser-g%2Fstep-react-redux/lists"}