{"id":15979225,"url":"https://github.com/perry-mitchell/use-reducer-state","last_synced_at":"2025-08-23T14:15:31.877Z","repository":{"id":224919015,"uuid":"764588248","full_name":"perry-mitchell/use-reducer-state","owner":"perry-mitchell","description":"React useReducer with state getter","archived":false,"fork":false,"pushed_at":"2024-02-28T13:06:29.000Z","size":46,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-14T12:38:40.801Z","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/perry-mitchell.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2024-02-28T10:57:49.000Z","updated_at":"2024-02-28T13:01:57.000Z","dependencies_parsed_at":"2024-11-09T06:36:39.014Z","dependency_job_id":"5740da98-f8f4-4c8d-b35d-ffc8604871c8","html_url":"https://github.com/perry-mitchell/use-reducer-state","commit_stats":null,"previous_names":["perry-mitchell/use-reducer-state"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/perry-mitchell/use-reducer-state","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perry-mitchell%2Fuse-reducer-state","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perry-mitchell%2Fuse-reducer-state/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perry-mitchell%2Fuse-reducer-state/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perry-mitchell%2Fuse-reducer-state/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/perry-mitchell","download_url":"https://codeload.github.com/perry-mitchell/use-reducer-state/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perry-mitchell%2Fuse-reducer-state/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271751927,"owners_count":24814707,"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-08-23T02:00:09.327Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":[],"created_at":"2024-10-07T23:41:38.817Z","updated_at":"2025-08-23T14:15:31.857Z","avatar_url":"https://github.com/perry-mitchell.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# useReducer state\n\n\u003e React `useReducer` with state getter\n\n## About\n\nA simple React hook `useReducer` implementation that supports state getting. Instead of just receiving the `state` and `dispatch` results from the `useReducer` hook, you receive a third option for fetching the state.\n\n## Installation\n\nInstall by running `npm install use-reducer-state --save-dev`, and import it in your project for it to be bundled by whatever build system you're using.\n\n## Usage\n\nImport `useReducer` just as you would from React:\n\n```typescript\nimport React from \"react\";\nimport { useReducer } from \"use-reducer-state\";\n\nfunction initialStateGetter() {\n    return {\n        // ...\n    };\n}\n\nfunction reducerFn(state, action) {\n    switch (action.type) {\n        // ...\n    }\n}\n\nexport function MyComponent() {\n    const [state, dispatch, getState] = useReducer(reducerFn, initialStateGetter);\n    // ...\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperry-mitchell%2Fuse-reducer-state","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperry-mitchell%2Fuse-reducer-state","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperry-mitchell%2Fuse-reducer-state/lists"}