{"id":15070001,"url":"https://github.com/gmullerb/react-reducer-provider","last_synced_at":"2026-02-02T23:48:57.596Z","repository":{"id":52804559,"uuid":"255460461","full_name":"gmullerb/react-reducer-provider","owner":"gmullerb","description":"Asynchronous/Synchronous React Reducer Provider with Hooks","archived":false,"fork":false,"pushed_at":"2021-05-14T14:48:38.000Z","size":763,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-11T07:43:50.857Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/gmullerb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-13T23:06:38.000Z","updated_at":"2021-11-17T16:13:10.000Z","dependencies_parsed_at":"2022-09-17T06:21:22.740Z","dependency_job_id":null,"html_url":"https://github.com/gmullerb/react-reducer-provider","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gmullerb/react-reducer-provider","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmullerb%2Freact-reducer-provider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmullerb%2Freact-reducer-provider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmullerb%2Freact-reducer-provider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmullerb%2Freact-reducer-provider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gmullerb","download_url":"https://codeload.github.com/gmullerb/react-reducer-provider/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmullerb%2Freact-reducer-provider/sbom","scorecard":{"id":430961,"data":{"date":"2025-08-11","repo":{"name":"github.com/gmullerb/react-reducer-provider","commit":"d7214dc611d0e7a29b5e0f2ab8f1c8e97c04294b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.6,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Binary-Artifacts","score":9,"reason":"binaries present in source code","details":["Warn: binary detected: gradle/wrapper/gradle-wrapper.jar:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 1 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"78 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-q8pj-2vqx-8ggc","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-j4f2-536g-r55m","Warn: Project is vulnerable to: GHSA-r7qp-cfhv-p84w","Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q","Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-7x7c-qm48-pq9c","Warn: Project is vulnerable to: GHSA-rc3x-jf5g-xvc5","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-82v2-mx6x-wq7q","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-rp65-9cf3-cjxr","Warn: Project is vulnerable to: GHSA-6fx8-h7jm-663j","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-44c6-4v22-4mhx","Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch","Warn: Project is vulnerable to: GHSA-hxcc-f52p-wc94","Warn: Project is vulnerable to: GHSA-fxwf-4rqh-v8g3","Warn: Project is vulnerable to: GHSA-25hc-qcg6-38wj","Warn: Project is vulnerable to: GHSA-xfhh-g9f5-x4m4","Warn: Project is vulnerable to: GHSA-qm95-pgcg-qqfq","Warn: Project is vulnerable to: GHSA-cqmj-92xf-r6r9","Warn: Project is vulnerable to: GHSA-vx3p-948g-6vhq","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-394c-5j6w-4xmx","Warn: Project is vulnerable to: GHSA-78cj-fxph-m83p","Warn: Project is vulnerable to: GHSA-fhg7-m89q-25r3","Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-72mh-269x-7mh5","Warn: Project is vulnerable to: GHSA-h4j5-c7cj-74xg","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T03:20:04.132Z","repository_id":52804559,"created_at":"2025-08-19T03:20:04.133Z","updated_at":"2025-08-19T03:20:04.133Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29024337,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-02T23:43:56.073Z","status":"ssl_error","status_checked_at":"2026-02-02T23:43:49.438Z","response_time":58,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-09-25T01:46:23.476Z","updated_at":"2026-02-02T23:48:57.580Z","avatar_url":"https://github.com/gmullerb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://react-reducer-provider.github.io/\"\u003e\u003cimg src=\"docs/react-reducer-provider.png\" alt=\" \"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eAsynchronous/Synchronous React Centralized State\u003c/h1\u003e\n\u003ch2 align=\"center\"\u003ewith Hooks and HOC\u003c/h2\u003e\n\n\u003cp align=\"center\"\u003ethrough Centralized \u003cb\u003e\u003ca hef=\"https://react-reducer-provider.github.io/docs/using-reducer.html\"\u003eReducers\u003c/a\u003e/\u003ca hef=\"https://react-reducer-provider.github.io/docs/using-mapper.html\"\u003eMappers\u003c/a\u003e/\u003ca hef=\"https://react-reducer-provider.github.io/docs/using-actuator.html\"\u003eActuators\u003c/a\u003e\u003c/b\u003e\u003c/p\u003e\n\u003cp align=\"center\"\u003eFlux/Redux made \u003cb\u003eEasy, Simple\u003c/b\u003e and Beyond\u003c/p\u003e\n\n[![react-reducer-provider](https://badgen.net/badge/homepage/react-reducer-provider/blue)](https://react-reducer-provider.github.io/)\n[![react-reducer-provider](https://badgen.net/badge/npmjs/react-reducer-provider/blue)](https://www.npmjs.com/package/react-reducer-provider)\n[![ ](https://badgen.net/npm/v/react-reducer-provider)](https://www.npmjs.com/package/react-reducer-provider)\n[![ ](https://badgen.net/bundlephobia/minzip/react-reducer-provider)](https://bundlephobia.com/result?p=react-reducer-provider)\n[![ ](https://badgen.net/bundlephobia/dependency-count/react-reducer-provider)](https://bundlephobia.com/result?p=react-reducer-provider)\n[![ ](https://badgen.net/bundlephobia/tree-shaking/react-reducer-provider)](https://bundlephobia.com/result?p=react-reducer-provider)\n[![ ](https://badgen.net/npm/types/react-reducer-provider)](https://react-reducer-provider.github.io/docs/typings.html)\n[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://react-reducer-provider.github.io/LICENSE.txt)\n[![ ](https://badgen.net/badge/test/passing/green)](https://gmullerb.gitlab.io/react-reducer-provider/tests/tests_report.html)\n[![ ](https://gitlab.com/gmullerb/react-reducer-provider/badges/master/coverage.svg)](https://gmullerb.gitlab.io/react-reducer-provider/coverage/index.html)\n[![Github repo](https://badgen.net/badge/icon/github?icon=github\u0026label)](https://github.com/gmullerb/react-reducer-provider)\n[![Gitlab repo](https://badgen.net/badge/icon/gitlab?icon=gitlab\u0026label)](https://gitlab.com/gmullerb/react-reducer-provider)\n\n__________________\n\n**`react-reducer-provider` provides a centralized state, managed asynchronously or synchronously through a reducer, mapper or actuator.**\n\n__________________\n\n## Quick Start\n\n1 . Add dependency:\n\n`package.json`:\n\nwhen using hooks:\n\n```json\n  ..\n  \"dependencies\": {\n    \"react\": \"\u003e=16.8.0\"\n    \"react-reducer-provider\": \"5.1.0\",\n    ..\n```\n\nwhen using HOC:\n\n```json\n  ..\n  \"dependencies\": {\n    \"react\": \"\u003e=16.0.0\"\n    \"react-reducer-provider\": \"5.1.0\",\n    ..\n```\n\n### [Reducers](https://react-reducer-provider.github.io/docs/using-reducer.html)\n\n2 . Create the **[`AsyncReducerProvider`](https://react-reducer-provider.github.io/docs/using-reducer.html#asyncreducerprovider)** or **[`SyncReducerProvider`](https://react-reducer-provider.github.io/docs/using-reducer.html#syncreducerprovider)** component to manage the centralized state:\n\n![Reducers](docs/reducer.svg \"Reducers\")\n\na . Define the initial state.  \nb . Define the reducer function.  \nc . Define the Reducer Provider.\n\n**`SomeReducerProvider.jsx`**:\n\n```jsx\nimport React from 'react'\nimport { SyncReducerProvider } from 'react-reducer-provider'\n\nconst initialState = 0\n\nfunction reduce(prevState, action, delta) {\n  switch (action) {\n    case 'ACTION1':\n      return prevState + delta\n    case 'ACTION2':\n      return prevState - delta\n    default:\n      return prevState\n  }\n}\n\nfunction SomeReducerProvider({ children }) {\n  return (\n    \u003cSyncReducerProvider\n      reducer={reduce}\n      initialState={initialState}\n    \u003e\n      {children}\n    \u003c/SyncReducerProvider\u003e\n  )\n}\n\nexport default SomeReducerProvider\n```\n\n3 . Access the state and the dispatcher of the Provider component using the hooks or HOC provided by `'react-reducer-provider'`:\n\n* **[`useReducer`](https://react-reducer-provider.github.io/docs/using-reducer.html#usereducer)/[`injectReducer`](https://react-reducer-provider.github.io/docs/using-reducer.html#injectreducer)**.\n* **[`useReducerDispatcher`](https://react-reducer-provider.github.io/docs/using-reducer.html#usereducerdispatcher)/[`injectReducerDispatcher`](https://react-reducer-provider.github.io/docs/using-reducer.html#injectreducerdispatcher)**.\n* **[`useReducerState`](https://react-reducer-provider.github.io/docs/using-reducer.html#usereducerstate)/[`injectReducerState`](https://react-reducer-provider.github.io/docs/using-reducer.html#injectreducerstate)**.\n\n![Dispatcher](docs/dispatcher.svg \"Dispatcher\")\n\n`SomeComponent1.jsx` =\u003e using `useReducer`:\n\n```jsx\nimport { useReducer } from 'react-reducer-provider'\nimport React from 'react'\n\nexport default function SomeComponent1() {\n  const { state, dispatch } = useReducer()\n  return (\n    \u003cbutton onClick={() =\u003e dispatch('ACTION1', 2)}\u003e\n      Go up (from {state})!\n    \u003c/button\u003e\n  )\n}\n```\n\n`SomeComponent2.jsx` =\u003e using `injectReducerDispatcher`:\n\n```jsx\nimport { injectReducerDispatcher } from \"react-reducer-provider\";\nimport React from \"react\";\n\nclass SomeComponent2 extends React.Component {\n  render() {\n    return (\n      \u003cbutton onClick={() =\u003e {\n        const newState = dispatch('ACTION2', 1)\n        console.info(newState)\n      }}\u003e\n        Go down!\n      \u003c/button\u003e\n    )\n  }\n}\n\nexport default injectReducerDispatcher(SomeComponent2, 'dispatch')\n```\n\n`SomeComponentN.jsx` =\u003e using `useReducerState`:\n\n```jsx\nimport { useReducerState } from 'react-reducer-provider'\nimport React from 'react'\n\nexport default function SomeComponentN() {\n  const currentState = useReducerState()\n  return (\n    \u003cdiv\u003e\n      Current:{currentState}\n    \u003c/div\u003e\n  )\n}\n```\n\n4 . Wrap components which will consume the `SomeReducerProvider` component:\n\n`SomeContainer.jsx`:\n\n```jsx\nimport SomeComponent1 from './path/to/SomeComponent1'\nimport SomeComponent2 from './path/to/SomeComponent2'\nimport SomeComponentN from './path/to/SomeComponentN'\nimport SomeReducerProvider from '../path/to/SomeReducerProvider'\nimport React from 'react'\n\nexport default function SomeContainer() {\n  return (\n    \u003cSomeReducerProvider\u003e\n      \u003cSomeComponent1/\u003e\n      \u003cSomeComponent2/\u003e\n      \u003cSomeComponentN/\u003e\n    \u003c/SomeReducerProvider\u003e\n  )\n}\n```\n\n![SomeContainer](docs/use-provider-eg1.gif \"SomeContainer\")\n\n\u003e This `SyncReducerProvider` example can be checked on line at [gmullerb-react-reducer-provider codesandbox](https://codesandbox.io/s/gmullerb-react-reducer-provider-forked-pjkve?file=/src/SomeReducerProvider.jsx):\n[![Edit gmullerb-react-reducer-provider](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/gmullerb-react-reducer-provider-forked-pjkve?file=/src/SomeReducerProvider.jsx)  \n\u003e This `SyncReducerProvider`with HOC example can be checked on line at [gmullerb-react-reducer-provider codesandbox](https://codesandbox.io/s/gmullerb-react-reducer-provider-forked-lj4si?file=/src/SomeReducerProvider.jsx):  \n[![Edit gmullerb-react-reducer-provider](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/gmullerb-react-reducer-provider-forked-lj4si?file=/src/SomeReducerProvider.jsx)  \n\u003e An `AsyncReducerProvider` example can be checked on line at [gmullerb-react-reducer-provider-async codesandbox](https://codesandbox.io/s/gmullerb-react-reducer-provider-async-forked-cyl3g?file=/src/SomeReducerProvider.jsx):  \n[![Edit gmullerb-react-reducer-provider-async](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/gmullerb-react-reducer-provider-async-forked-cyl3g?file=/src/SomeReducerProvider.jsx)  \n\u003e Examples of use can be looked at [basecode-react-ts](https://github.com/gmullerb/basecode-react-ts) and [test files](https://github.com/gmullerb/react-reducer-provider/blob/HEAD/tests/js).  \n\n### [Mappers](https://react-reducer-provider.github.io/docs/using-mapper.html)\n\n2 . Create the **[`AsyncMapperProvider`](https://react-reducer-provider.github.io/docs/using-mapper.html#asyncmapperprovider)** or **[`SyncMapperProvider`](https://react-reducer-provider.github.io/docs/using-mapper.html#syncmapperprovider)** component to manage the centralized state:\n\n![Mappers](docs/mapper.svg \"Mappers\")\n\na . Define the initial state.  \nb . Define the mapper function.  \nc . Define the Mapper Provider.\n\n**`SomeMapperProvider.jsx`**:\n\n```jsx\nimport React from \"react\";\nimport { SyncMapperProvider } from \"react-reducer-provider\";\n\nconst initialState = 0;\n\nfunction map(action) {\n  switch (action) {\n    case \"ACTION1\":\n      return 1;\n    case \"ACTION2\":\n      return -1;\n    default:\n      return 0;\n  }\n}\n\nfunction SomeMapperProvider({ children }) {\n  return (\n    \u003cSyncMapperProvider\n      id=\"someNamedMapper\"\n      mapper={map}\n      initialState={initialState}\n    \u003e\n      {children}\n    \u003c/SyncMapperProvider\u003e\n  );\n}\n\nexport { SomeMapperProvider };\n```\n\n3 . Access the state and the dispatcher of the Provider component using the hooks or HOC provided by `'react-reducer-provider'`:\n\n* **[`useMapper`](https://react-reducer-provider.github.io/docs/using-mapper.html#usemapper)/[`injectMapper`](https://react-reducer-provider.github.io/docs/using-mapper.html#injectmapper)**.\n* **[`useMapperDispatcher`](https://react-reducer-provider.github.io/docs/using-mapper.html#usemapperdispatcher)/[`injectMapperDispatcher`](https://react-reducer-provider.github.io/docs/using-mapper.html#injectmapperdispatcher)**.\n* **[`useMapperState`](https://react-reducer-provider.github.io/docs/using-mapper.html#usemapperstate)/[`injectMapperState`](https://react-reducer-provider.github.io/docs/using-mapper.html#injectmapperstate)**.\n\n![Dispatcher](docs/dispatcher.svg \"Dispatcher\")\n\n`SomeComponent1.jsx` =\u003e using `useMapper`:\n\n```jsx\nimport { useMapper } from \"react-reducer-provider\";\nimport React from \"react\";\n\nexport default function SomeComponent1() {\n  const [state, dispatch] = useMapper(\"someNamedMapper\");\n  return (\n    \u003cbutton onClick={() =\u003e dispatch(\"ACTION1\")}\u003e\n      Set to 1 (from {state})!\n    \u003c/button\u003e\n  );\n}\n```\n\n`SomeComponent2.jsx` =\u003e using `useMapperDispatcher`:\n\n```jsx\nimport { useMapperDispatcher } from \"react-reducer-provider\";\nimport React from \"react\";\n\nexport default function SomeComponent2() {\n  const dispatch = useMapperDispatcher(\"someNamedMapper\");\n  return \u003cbutton onClick={() =\u003e dispatch(\"ACTION2\")}\u003eSet to -1!\u003c/button\u003e;\n}\n```\n\n`SomeComponentN.jsx` =\u003e using `injectMapperState`:\n\n```jsx\nimport { injectMapperState } from \"react-reducer-provider\";\nimport React from \"react\";\n\nclass SomeComponentN extends React.Component {\n  render() {\n    return \u003cdiv\u003eCurrent:{this.props.currentState}\u003c/div\u003e;\n  }\n}\n\nexport default injectMapperState(SomeComponentN, 'currentState')\n```\n\n4 . Wrap components which will consume the `SomeMapperProvider` component:\n\n`SomeContainer.jsx`:\n\n```jsx\nimport SomeComponent1 from \"./SomeComponent1\";\nimport SomeComponent2 from \"./SomeComponent2\";\nimport SomeComponentN from \"./SomeComponentN\";\nimport { SomeMapperProvider } from \"./SomeMapperProvider\";\nimport React from \"react\";\n\nexport default function SomeContainer() {\n  return (\n    \u003cSomeMapperProvider\u003e\n      \u003cSomeComponent1 /\u003e\n      \u003cSomeComponent2 /\u003e\n      \u003cSomeComponentN /\u003e\n    \u003c/SomeMapperProvider\u003e\n  );\n}\n```\n\n![SomeContainer](docs/use-provider-eg2.gif \"SomeContainer\")\n\n\u003e An `SyncMapperProvider` example can be checked on line at [gmullerb-react-mapper-provider codesandbox](https://codesandbox.io/s/gmullerb-react-mapper-provider-yvwx7?file=/src/SomeMapperProvider.jsx):  \n[![Edit gmullerb-react-mapper-provider](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/gmullerb-react-mapper-provider-yvwx7?file=/src/SomeMapperProvider.jsx)  \n\u003e An `AsyncMapperProvider` example can be checked on line at [gmullerb-react-mapper-provider-async codesandbox](https://codesandbox.io/s/gmullerb-react-mapper-provider-async-forked-d2foz?file=/src/SomeMapperProvider.jsx):  \n[![Edit gmullerb-react-mapper-provider-async](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/gmullerb-react-mapper-provider-async-forked-d2foz?file=/src/SomeMapperProvider.jsx)  \n\u003e Examples of use can be looked at [test files](https://github.com/gmullerb/react-reducer-provider/blob/HEAD/tests/js).  \n\n### [Actuators](https://react-reducer-provider.github.io/docs/using-actuator.html)\n\n2 . Create the **[`ActuatorProvider`](https://react-reducer-provider.github.io/docs/using-actuator.html#actuatorprovider)** component to manage a state (or whatever you need, not only state):\n\n![Actuators](docs/actuator.svg \"Actuators\")\n\na . Define actuator function.  \nb . Define Actuator Provider.  \nc. Wrap components which will consume the `ActuatorProvider`:\n\n`SomeContainer.jsx`:\n\n```jsx\nimport SomeComponent1 from './path/to/SomeComponent1'\nimport SomeComponent2 from './path/to/SomeComponent2'\nimport { ActuatorProvider } from 'react-reducer-provider'\nimport React from 'react'\n\nexport function SomeContainer() {\n  const [state, setState] = React.useState(0)\n  const actuate = delta =\u003e setState(state + delta)\n  return (\n    \u003cdiv\u003e\n      \u003cActuatorProvider actuator={actuate}\u003e\n        \u003cSomeComponent1/\u003e\n        \u003cSomeComponent2/\u003e\n      \u003c/ActuatorProvider\u003e\n      \u003cdiv\u003e\n        Current:{state}\n      \u003c/div\u003e\n    \u003c/div\u003e\n  )\n}\n```\n\n3 . Access dispatcher of the Provider component using the hooks or HOC provided by `'react-reducer-provider'`:\n\n* **[`useActuator`](https://react-reducer-provider.github.io/docs/using-actuator.html#useactuator)/[`injectActuator`](https://react-reducer-provider.github.io/docs/using-actuator.html#injectactuator)**.\n\n![Dispatcher](docs/dispatcher.svg \"Dispatcher\")\n\n`SomeComponent1.jsx` =\u003e using `useActuator`:\n\n```jsx\nimport { useActuator } from 'react-reducer-provider'\nimport React from 'react'\n\nexport function SomeComponent1() {\n  const dispatch = useActuator()\n  return (\n    \u003cbutton onClick={() =\u003e dispatch(+1)}\u003e\n      Go up!\n    \u003c/button\u003e\n  )\n}\n```\n\n`SomeComponent2.jsx` =\u003e using `injectActuator`:\n\n```jsx\nimport { injectActuator } from \"react-reducer-provider\";\nimport React from \"react\";\n\nclass SomeComponent2 extends React.Component {\n  render() {\n    return (\n      \u003cbutton\n        onClick={() =\u003e {\n          const newState = this.props.dispatch(-1);\n          console.info(newState);\n        }}\n      \u003e\n        Go down!\n      \u003c/button\u003e\n    );\n  }\n}\n\nexport default injectActuator(SomeComponent2, \"dispatch\");\n```\n\n![SomeContainer](docs/use-provider-eg3.gif \"SomeContainer\")\n\n\u003e This `ActuatorProvider` example can be checked on line at [gmullerb-react-actuator-provider codesandbox](https://codesandbox.io/s/gmullerb-react-actuator-provider-5sl0o?file=/src/SomeContainer.jsx):  \n[![Edit gmullerb-react-reducer-provider](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/gmullerb-react-actuator-provider-5sl0o?file=/src/SomeContainer.jsx)  \n\u003e Examples of use can be looked at [test files](https://github.com/gmullerb/react-reducer-provider/blob/HEAD/tests/js).  \n\n__________________\n\n## Goal\n\nWith the introduction of React Hooks, in some way using Flux **library**[1] was deprecated, `react-reducer-provider` looks to **give a quick and easy alternative using hooks to implement Flux with reducers**.\n\n* Provides Reducers, but also **Mappers** and **Actuators**.\n* It allows to use [**Asynchronous** Reducer/Mapper/Dispatcher](https://react-reducer-provider.github.io/docs/reference-definition.html#asyncreducerprovider).\n* [Reducer/Mapper/Dispatcher can have **more parameters/arguments** than traditional reducer which have only (state, action)](https://react-reducer-provider.github.io/docs/reference-definition.html#extraparameters).\n* [Dispatcher **returns the new State or a Promise of the new State**](https://react-reducer-provider.github.io/docs/reference-definition.html#dispatcher).\n* **Actuator** allows you to easily introduced centralized state without moving your existing state, i.e. allows you to avoid using a new state container if you already have one.\n* [Each Reducer/Mapper/Actuators Provider can have a **different names, numbers or symbols which allows for easy identification and nesting**](https://react-reducer-provider.github.io/docs/nesting.html).\n* Provides and Easy way of combining reducer/mapper/actuator functions. through Tags. [2].\n* **Smaller** than other packages with \"same\" functionality, and no dependencies [3].\n* It is ready for **Tree Shaking optimization**, so you get only what you need from the `react-reducer-provider` in the final app bundle [3].\n* It provides [its own **type definitions for Typescript and Flow**](https://react-reducer-provider.github.io/docs/typings.html).\n* **Full Tested**, not only focus in coverage, but also in cases and typings: [tests](https://github.com/gmullerb/react-reducer-provider/blob/HEAD/tests/js), [results](https://gmullerb.gitlab.io/react-reducer-provider/tests/tests_report.html), [coverage](https://gmullerb.gitlab.io/react-reducer-provider/coverage/index.html) and [typings tests](https://github.com/gmullerb/react-reducer-provider/blob/HEAD/tests/typings).\n\n\u003e [1] Not the Flux architecture.  \n\u003e [2] react-redux makes it too complicated.  \n\u003e [3] Check and Compare with other solutions at [bundlephobia.com](https://bundlephobia.com/result?p=react-reducer-provider).  \n\u003e `react-reducer-provider` is the evolution of [react-named-reducer](https://www.npmjs.com/package/react-named-reducer) (which is a derivation of [react-reducer-context](https://www.npmjs.com/package/react-reducer-context)).\n\n__________________\n\n**You define**:\n\n![Reducers](docs/reducer.svg \"Reducers\")\n\n**or**\n\n![Mappers](docs/mapper.svg \"Mappers\")\n\n**or**\n\n![Actuators](docs/actuator.svg \"Actuators\")\n\n__________________\n\n**and then you use them through a**:\n\n![Dispatcher](docs/dispatcher.svg \"Dispatcher\")\n\n__________________\n\n## Prerequisites\n\n**At least [`\"react\": \"\u003e=16.0.0\"`]** - [React Context](https://reactjs.org/docs/context.html) =\u003e when using HOC, i.e. [`injectReducer` · `injectReducerState` · `injectReducerDispatcher` · `injectMapper` · `injectMapperState` · `injectMapperDispatcher`](https://react-reducer-provider.github.io/docs/reference-consumption-hoc.html) or [`injectTaggedAny` · `injectTaggedReducer` · `injectTaggedReducerState` · `injectTaggedReducerDispatcher` · `injectTaggedMapper` · `injectTaggedMapperState` · `injectTaggedMapperDispatcher`](https://react-reducer-provider.github.io/docs/tagged-consumption-hoc.html).\n\n**[`\"react\": \"\u003e=16.8.0\"`]** - [React Hooks](https://reactjs.org/docs/hooks-overview.html) =\u003e when using hooks, i.e. [`useReducer` · `useReducerState` · `useReducerDispatcher` · `useMapper` · `useMapperState` · `useMapperDispatcher`](https://react-reducer-provider.github.io/docs/reference-consumption-hooks.html) or [`useTaggedAny` · `useTaggedReducer` · `useTaggedReducerState` · `useTaggedReducerDispatcher` · `useTaggedMapper` · `useTaggedMapperState` · `useTaggedMapperDispatcher`](https://react-reducer-provider.github.io/docs/tagged-consumption-hooks.html).\n\n\u003e`react-reducer-provider` only enforces `\"react\": \"\u003e=16.0.0\"` in `package.json` is up to you to be set which version you need.\n\n__________________\n\n## Documentation\n\n* [Reducers](https://react-reducer-provider.github.io/docs/using-reducer.html)\n  * [`AsyncReducerProvider`](https://react-reducer-provider.github.io/docs/using-reducer.html#asyncreducerprovider).\n  * [`SyncReducerProvider`](https://react-reducer-provider.github.io/docs/using-reducer.html#syncreducerprovider).\n  * Hooks:\n    * [`useReducer`](https://react-reducer-provider.github.io/docs/using-reducer.html#usereducer).\n    * [`useReducerDispatcher`](https://react-reducer-provider.github.io/docs/using-reducer.html#usereducerdispatcher).\n    * [`useReducerState`](https://react-reducer-provider.github.io/docs/using-reducer.html#usereducerstate).\n  * HOC:\n    * [`injectReducer`](https://react-reducer-provider.github.io/docs/using-reducer.html#injectreducer).\n    * [`injectReducerDispatcher`](https://react-reducer-provider.github.io/docs/using-reducer.html#injectreducerdispatcher).\n    * [`injectReducerState`](https://react-reducer-provider.github.io/docs/using-reducer.html#injectreducerstate).\n\n* [Mappers](https://react-reducer-provider.github.io/docs/using-mapper.html).\n  * [`AsyncMapperProvider`](https://react-reducer-provider.github.io/docs/using-mapper.html#asyncmapperprovider).\n  * [`SyncMapperProvider`](https://react-reducer-provider.github.io/docs/using-mapper.html#syncmapperprovider).\n  * Hooks:\n    * [`useMapper`](https://react-reducer-provider.github.io/docs/using-mapper.html#usemapper).\n    * [`useMapperDispatcher`](https://react-reducer-provider.github.io/docs/using-mapper.html#usemapperdispatcher).\n    * [`useMapperState`](https://react-reducer-provider.github.io/docs/using-mapper.html#usemapperstate).\n  * HOC:\n    * [`injectMapper`](https://react-reducer-provider.github.io/docs/using-mapper.html#injectmapper).\n    * [`injectMapperDispatcher`](https://react-reducer-provider.github.io/docs/using-mapper.html#injectmapperdispatcher).\n    * [`injectMapperState`](https://react-reducer-provider.github.io/docs/using-mapper.html#injectmapperstate).\n* [Actuators](https://react-reducer-provider.github.io/docs/using-actuator.html).\n  * [`ActuatorProvider`](https://react-reducer-provider.github.io/docs/using-actuator.html#actuatorprovider).\n  * Hooks:\n    * [`useActuator`](https://react-reducer-provider.github.io/docs/using-actuator.html#useactuator).\n  * HOC:\n    * [`injectActuator`](https://react-reducer-provider.github.io/docs/using-actuator.html#injectactuator).\n* [Singleton](https://react-reducer-provider.github.io/docs/singleton.html).\n* [Nesting Providers](https://react-reducer-provider.github.io/docs/nesting.html).\n* Combining/Blending - Tagged Reducers/Mappers/Actuator.\n  * [`AsyncTaggedReducerProvider` · `SyncTaggedReducerProvider` · `AsyncTaggedMapperProvider` · `SyncTaggedMapperProvider` · `TaggedActuatorProvider`](https://react-reducer-provider.github.io/docs/tagged-definition.html).\n  * [`useTaggedAny` · `useTaggedReducer` · `useTaggedReducerState` · `useTaggedReducerDispatcher` · `useTaggedMapper` · `useTaggedMapperState` · `useTaggedMapperDispatcher` · `useTaggedActuator`](https://react-reducer-provider.github.io/docs/tagged-consumption-hooks.html).\n  * [`injectTaggedAny` · `injectTaggedReducer` · `injectTaggedReducerState` · `injectTaggedReducerDispatcher` · `injectTaggedMapper` · `injectTaggedMapperState` · `injectTaggedMapperDispatcher` · `injectTaggedActuator`](https://react-reducer-provider.github.io/docs/tagged-consumption-hoc.html).\n* [Typings](https://react-reducer-provider.github.io/docs/typings.html).\n* Extras:\n  * [With Injection](https://react-reducer-provider.github.io/docs/with-injection.html).\n    * [with Flow typings](https://react-reducer-provider.github.io/docs/with-injection-and-flow-typings.html).\n    * [with Typescript typings](https://react-reducer-provider.github.io/docs/with-injection-and-ts-typings.html).\n  * [With Actions Creators](https://react-reducer-provider.github.io/docs/with-actions-creators.html).\n    * [with Flow typings](https://react-reducer-provider.github.io/docs/with-actions-creators-and-flow-typings.html).\n    * [with Typescript typings](https://react-reducer-provider.github.io/docs/with-actions-creators-and-ts-typings.html).\n  * [Testing](https://react-reducer-provider.github.io/docs/testing.html).\n  * Examples:\n    * **[Online examples](https://react-reducer-provider.github.io/docs/online.html)**.\n    * [Examples from tests](https://github.com/gmullerb/react-reducer-provider/blob/HEAD/tests/js).\n    * [Typings' examples from tests](https://github.com/gmullerb/react-reducer-provider/blob/HEAD/tests/typings).\n  * [Migration](https://react-reducer-provider.github.io/docs/migration.html).\n  * [Extending/Developing](https://react-reducer-provider.github.io/docs/developing.html).\n\n* [`CHANGELOG`](https://react-reducer-provider.github.io/docs/CHANGELOG.html): add information of notable changes for each version here, chronologically ordered ([Keep a Changelog](http://keepachangelog.com)).\n\n## Contributing\n\n* **Use it**.\n* **Share it**.\n* [Give it a Star](https://github.com/gmullerb/react-reducer-provider).\n* [Propose changes or improvements](https://github.com/gmullerb/react-reducer-provider/issues).\n* [Report bugs](https://github.com/gmullerb/react-reducer-provider/issues).\n\n## License\n\n[MIT License](https://react-reducer-provider.github.io/LICENSE.txt)\n\n__________________\n\n## Remember\n\n* Use code style verification tools =\u003e Encourages Best Practices, Efficiency, Readability and Learnability.\n* Code Review everything =\u003e Encourages Functional suitability, Performance Efficiency and Teamwork.\n* If viable, Start testing early =\u003e Encourages Reliability and Maintainability.\n\n## Additional words\n\nDon't forget:\n\n* **Love what you do**.\n* **Learn everyday**.\n* **Learn yourself**.\n* **Share your knowledge**.\n* **Think different!**.\n* **Learn from the past, dream on the future, live and enjoy the present to the max!**.\n* **Enjoy and Value the Quest** (It's where you learn and grow).\n\nAt life:\n\n* Let's act, not complain.\n* Be flexible.\n\nAt work:\n\n* Let's give solutions, not questions.\n* Aim to simplicity not intellectualism.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgmullerb%2Freact-reducer-provider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgmullerb%2Freact-reducer-provider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgmullerb%2Freact-reducer-provider/lists"}