{"id":17353683,"url":"https://github.com/salvoravida/redux-immer","last_synced_at":"2025-05-12T14:29:15.986Z","repository":{"id":34897411,"uuid":"187965931","full_name":"salvoravida/redux-immer","owner":"salvoravida","description":"Redux combineReducers immer-aware! ","archived":false,"fork":false,"pushed_at":"2023-03-03T14:36:07.000Z","size":1074,"stargazers_count":77,"open_issues_count":4,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-12T14:29:07.897Z","etag":null,"topics":["combinereducers","immer","immutable","redux","redux-immer","redux-immutable"],"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/salvoravida.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-22T05:00:24.000Z","updated_at":"2025-01-11T00:01:57.000Z","dependencies_parsed_at":"2024-06-18T17:08:59.007Z","dependency_job_id":"91d8e03e-961b-4ac2-bdba-55e75d10ec5d","html_url":"https://github.com/salvoravida/redux-immer","commit_stats":{"total_commits":28,"total_committers":4,"mean_commits":7.0,"dds":0.4642857142857143,"last_synced_commit":"a31c97fc7b171de3cd6c9d2681f8f9d144a3471b"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salvoravida%2Fredux-immer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salvoravida%2Fredux-immer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salvoravida%2Fredux-immer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salvoravida%2Fredux-immer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/salvoravida","download_url":"https://codeload.github.com/salvoravida/redux-immer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253754721,"owners_count":21958898,"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":["combinereducers","immer","immutable","redux","redux-immer","redux-immutable"],"created_at":"2024-10-15T17:17:42.028Z","updated_at":"2025-05-12T14:29:15.959Z","avatar_url":"https://github.com/salvoravida.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redux-immer  [![npm version](https://img.shields.io/npm/v/redux-immer.svg?style=flat)](https://www.npmjs.org/package/redux-immer)\n\n`redux-immer` is used to create an equivalent function of Redux combineReducers that works with `immer` state. \u003c/br\u003e\nLike `redux-immutable` but for `immer`\n\nInstallation\n-----------\nUsing [npm](https://www.npmjs.com/):\n\n    $ npm install --save redux-immer\n   \n# Features\n \n* one time only produce\n* standard-like reducers\n* support react-router routerReducer integration (`redux-first-history` / `react-router-redux` / `connected-react-router`)\n\nUsage\n-----\n\nstore.js\n\n```javascript\nimport { createStore, applyMiddleware } from 'redux';\nimport { combineReducers } from 'redux-immer';\nimport produce from 'immer';\n\n// Reducers\nimport { user } from './user';\nimport { catalog } from './catalog';\n\nexport const store = createStore(\n  combineReducers(produce, {\n     user,\n     catalog,\n     // ...\n  }),\n  // applyMiddleware...\n);\n```\n\nuser.js \n```javascript\nconst initialState = {\n  id: null,\n  profile: {}\n};\n\nexport const user = (state = initialState, action) =\u003e {\n  switch (action.type) {\n    case LOAD_USER: \n      state.id = action.id;\n      state.profile = action.profile;\n      return state; // or just return; (immer way)\n    default:\n      return state;  //important return state on default for initialState!!\n  }\n};\n```\n\ncatalog.js \n```javascript\nconst initialState = [];\n\nexport const catalog = (state = initialState, action) =\u003e {\n  switch (action.type) {\n    case LOAD_CATALOG:\n      state = action.data;\n      return state; // or just return; (immer way)\n    default:\n      return state;  //important return draft on default for initialState!!\n  }\n};\n```\n\n# Tips\nYou may call `combineReducers` at any level of the reducer hierarchy. It doesn't have to happen at the top. In fact you may use it again to split the child reducers that get too complicated into independent grandchildren, and so on. (exact as original redux.combineReducer https://redux.js.org/api/combinereducers)\n\n# Feedback\n\nLet me know what do you think! \u003cbr\u003e\n*Enjoy it? Star this project!* :D\n\nany idea? let me know and contribute!\n\nContributors\n------------\nSee [Contributors](https://github.com/salvoravida/redux-immer/graphs/contributors).\n\nLicense\n-------\n[MIT License](https://github.com/salvoravida/redux-immer/blob/master/LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalvoravida%2Fredux-immer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsalvoravida%2Fredux-immer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalvoravida%2Fredux-immer/lists"}