{"id":17279333,"url":"https://github.com/liveduo/simple-redux","last_synced_at":"2026-01-19T05:33:20.234Z","repository":{"id":42816619,"uuid":"268391730","full_name":"LiveDuo/simple-redux","owner":"LiveDuo","description":"A redux wrapper to get started quickly","archived":false,"fork":false,"pushed_at":"2023-01-06T07:33:36.000Z","size":519,"stargazers_count":1,"open_issues_count":8,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T18:52:41.858Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LiveDuo.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-01T00:51:17.000Z","updated_at":"2022-12-22T03:57:24.000Z","dependencies_parsed_at":"2023-02-05T15:32:11.602Z","dependency_job_id":null,"html_url":"https://github.com/LiveDuo/simple-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/LiveDuo%2Fsimple-redux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiveDuo%2Fsimple-redux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiveDuo%2Fsimple-redux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiveDuo%2Fsimple-redux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LiveDuo","download_url":"https://codeload.github.com/LiveDuo/simple-redux/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247459861,"owners_count":20942306,"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":[],"created_at":"2024-10-15T09:16:55.201Z","updated_at":"2026-01-19T05:33:20.195Z","avatar_url":"https://github.com/LiveDuo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003ch1 align=\"center\"\u003e\n  \u003cimg alt=\"hybrids - the web components\" src=\"https://raw.githubusercontent.com/LiveDuo/simple-redux/master/assets/simple-redux-logo.png\" width=\"500\" align=\"center\"\u003e\n  \u003cbr/\u003e\n\u003c/h1\u003e\n\n\u003c!--\n[![npm version](https://img.shields.io/npm/v/hybrids.svg?style=flat)](https://www.npmjs.com/package/hybrids)\n[![bundle size](https://img.shields.io/bundlephobia/minzip/hybrids.svg?label=minzip)](https://bundlephobia.com/result?p=hybrids)\n[![npm](https://img.shields.io/npm/dt/hybrids.svg)](https://www.npmjs.com/package/hybrids)\n[![GitHub](https://img.shields.io/github/license/hybridsjs/hybrids.svg)](LICENSE)\n--\u003e\n\n**Simple Redux** is a state management library for the layman. It is just a global store to get and update values.\n\n* **Dead simple** — One hook for receiving values and updating them.\n* **Redux based** — Opinionated version of Redux. Core Redux concepts still apply.\n* **Plug \u0026 Play** — Copy and paste the code below and you are ready to go.\n\n## Getting Started\n\n1. Install the npm package.\n    ```javascript\n    npm i simple-redux-js\n    ```\n\n2. Load the provider in App.js.\n\n    ```javascript\n    const App = () =\u003e (\n      \u003cSimpleProvider initialState={{ token: 'default_token' }}\u003e\n        \u003cChild\u003e\n      \u003c/SimpleProvider\u003e\n    )\n    ```\n\n3. Access and update global state in any other component.\n\n    ```javascript\n    const Child = () =\u003e {\n      const simpleDispatch = useSimpleDispatch()\n      return (\n        \u003cdiv\u003e\n          \u003cspan\u003e{useSimpleSelector('token')}\u003c/span\u003e\n          \u003cbutton onClick={() =\u003e simpleDispatch('token', 'value')}\u003e\n        \u003c/div\u003e\n      )\n    }\n    ```\n\n## Documentation\n\n- **useSimpleSelector** (propertyName\u003cstring\u003e)\nSelects the property by name from the store.\n``` javascript\nconst token = useSimpleSelector('token')\n```\n\n- **getSimpleState** (propertyName\u003cstring\u003e)\nSelects the property by name outside of a component.\n``` javascript\nconst token = getSimpleState('token')\n```\n\n- **getSimpleStates** ()\nSelects all states of the store outside of a component.\n``` javascript\nconst allStates = getSimpleStates()\n```\n\n- **store**\nAccess the store outside of a component.\n``` javascript\nstore.subscribe(() =\u003e {\n  console.log('the store has been updated')\n})\n```\n\n- **useSimpleDispatch** ()\nCreates a dispatch method to update the store.\n``` javascript\n  const simpleDispatch = useSimpleDispatch()\n```\n\n- **simpleDispatch** (propertyName\u003cstring\u003e, propertyValue\u003cstring\u003e)\nUpdates the property by name with the specified value.\n``` javascript\n  const setToken = (token) =\u003e simpleDispatch('token', token)\n```\n\n\u003c!--\n## Online Examples\n\n- [\u0026lt;user-auth\u0026gt;](https://brokenlink.com) - user auth state\n- [\u0026lt;todo-app\u0026gt;](https://brokenlink.com) - todo app example\n--\u003e\n\n## Full Example\n\n```javascript\n// App.js\nimport React from 'react'\nimport ReactDom from 'react-dom'\n\nimport { SimpleProvider } from 'simple-redux-js'\n\nimport { Child } from './Child'\n\nconst defaultToken = localStorage.getItem('token')\n\nconst App = () =\u003e (\n  \u003cSimpleProvider initialState={{ token: defaultToken }}\u003e\n    \u003cChild\u003e\n  \u003c/SimpleProvider\u003e\n)\nReactDom.render(\u003cApp/\u003e, document.getElementById('root'))\n\n// Child.js\nimport React from 'react'\n\nimport { useSimpleSelector, useSimpleDispatch } from 'simple-redux-js'\n\nconst Child = () =\u003e {\n  const simpleDispatch = useSimpleDispatch()\n  const token = useSimpleSelector('token')\n  const setToken = (token) =\u003e simpleDispatch('token', token)\n\n  return (\n    \u003cdiv\u003e\n      \u003cspan\u003e{token}\u003c/span\u003e\n      \u003cbutton onClick={() =\u003e setToken('user_token')}\u003e\n    \u003c/div\u003e\n  )\n}\nexport { Child }\n```\n\n## Publish\n```\nnpm login\ngit commit (clean repo)\nnpm version patch (or minor)\nnpm publish\ngit push\n```\n\n## License\n\n`simple-redux-js` is released under the [ISC License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliveduo%2Fsimple-redux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliveduo%2Fsimple-redux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliveduo%2Fsimple-redux/lists"}