{"id":23440765,"url":"https://github.com/dabapps/redux-create-reducer","last_synced_at":"2026-03-16T22:32:29.959Z","repository":{"id":34361641,"uuid":"176927399","full_name":"dabapps/redux-create-reducer","owner":"dabapps","description":"A utility to create redux reducers from a set of handlers","archived":false,"fork":false,"pushed_at":"2023-01-04T21:41:10.000Z","size":778,"stargazers_count":1,"open_issues_count":9,"forks_count":1,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-04-30T07:07:16.266Z","etag":null,"topics":[],"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/dabapps.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2019-03-21T11:02:07.000Z","updated_at":"2020-08-21T10:56:23.000Z","dependencies_parsed_at":"2023-01-15T06:34:21.250Z","dependency_job_id":null,"html_url":"https://github.com/dabapps/redux-create-reducer","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabapps%2Fredux-create-reducer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabapps%2Fredux-create-reducer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabapps%2Fredux-create-reducer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabapps%2Fredux-create-reducer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dabapps","download_url":"https://codeload.github.com/dabapps/redux-create-reducer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251658208,"owners_count":21622820,"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-12-23T16:18:33.005Z","updated_at":"2026-03-16T22:32:29.932Z","avatar_url":"https://github.com/dabapps.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redux-create-reducer\n\n**A utility to create redux reducers from a set of handlers**\n\n## About\n\nThis is a fork of [@jakesidsmith/redux-create-reducer](https://github.com/jakesidsmith/redux-create-reducer).\n\nThis utility removes the need for switch statements (which can easily result in errors), and instead allows you to create a redux reducer from a set of handler functions - no more need to handle a default case, no more boilerplate.\n\nThis library is written in TypeScript and due to how the handlers are typed, allows you to limit which actions they handle, and also define different action types for different handlers without casting their types.\n\n## Install\n\n```shell\nnpm i @dabapps/redux-create-reducer -S\n```\n\n## Usage\n\n```ts\nimport { createReducer } from '@dabapps/redux-create-reducer';\nimport { ADD, SUBTRACT, RESET } from './action-types';\n\ninterface NumberAction {\n  type: string;\n  payload: number;\n}\n\nexport const count = createReducer(\n  {\n    [ADD]: (state: number, action: NumberAction) =\u003e state + action.payload,\n    [SUBTRACT]: (state: number, action: NumberAction) =\u003e state - action.payload,\n    [RESET]: () =\u003e 0,\n  },\n  0 // Initial state (required)\n);\n```\n\n## Updating this fork from upstream\n\nEnsure you have added a remote upstream in git e.g.\n\n```shell\ngit remote add upstream git@github.com:JakeSidSmith/redux-create-reducer.git\n```\n\nCreate a new branch (from master) and run the following to pull changes from [upstream](https://github.com/jakesidsmith/redux-create-reducer):\n\n```shell\ngit fetch upstream\ngit pull upstream master\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdabapps%2Fredux-create-reducer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdabapps%2Fredux-create-reducer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdabapps%2Fredux-create-reducer/lists"}