{"id":16527156,"url":"https://github.com/zignis/dynux","last_synced_at":"2026-05-12T00:39:53.348Z","repository":{"id":175795713,"uuid":"654485664","full_name":"zignis/dynux","owner":"zignis","description":"Dynamic Redux reducers","archived":false,"fork":false,"pushed_at":"2023-06-16T15:19:51.000Z","size":2299,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-14T09:06:52.670Z","etag":null,"topics":["code-splitting","dynamic-reducers","reducer","redux","redux-toolkit"],"latest_commit_sha":null,"homepage":"","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/zignis.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":"2023-06-16T08:27:19.000Z","updated_at":"2024-03-16T15:33:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"850de0f7-8032-471f-9bfc-1f789cbee8b0","html_url":"https://github.com/zignis/dynux","commit_stats":{"total_commits":9,"total_committers":2,"mean_commits":4.5,"dds":"0.33333333333333337","last_synced_commit":"84f89953a6bed4c638aa3ebbb81948fbb49b2d14"},"previous_names":["zignis/dynux"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zignis%2Fdynux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zignis%2Fdynux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zignis%2Fdynux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zignis%2Fdynux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zignis","download_url":"https://codeload.github.com/zignis/dynux/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241245411,"owners_count":19933295,"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":["code-splitting","dynamic-reducers","reducer","redux","redux-toolkit"],"created_at":"2024-10-11T17:33:48.976Z","updated_at":"2025-11-29T02:10:11.162Z","avatar_url":"https://github.com/zignis.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dynux\n\n![npm](https://img.shields.io/npm/v/dynux?style=for-the-badge)\n![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/zignis/dynux/test.yml?style=for-the-badge)\n![npm](https://img.shields.io/npm/dw/dynux?style=for-the-badge)\n![NPM](https://img.shields.io/npm/l/dynux?style=for-the-badge)\n\n**Dyn**amic red**ux** reducer injection. Allows you to reduce the \nsize of your bundle by dynamically loading and registering reducers \non your Redux store. It is compatible with Redux Toolkit.\n\n## Test coverage\n\n| Statements                  | Branches                | Functions                 | Lines             |\n| --------------------------- | ----------------------- | ------------------------- | ----------------- |\n| ![Statements](https://img.shields.io/badge/statements-100%25-brightgreen.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-100%25-brightgreen.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-100%25-brightgreen.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-100%25-brightgreen.svg?style=flat) |\n\n## Configuration\n\n### With Redux\n\n```typescript\nimport { ReducerManager } from \"dynux\";\nimport { createStore, Reducer } from \"redux\";\n\nconst someReducer: Reducer = (state = null) =\u003e state;\nconst initialReducers = {\n  someReducer,\n};\n\nconst configureStore = () =\u003e {\n  // Optionally initialize with static reducers\n  const reducerManager = new ReducerManager(initialReducers);\n\n  // Create a store with the root reducer\n  const store = createStore(reducerManager.reduce);\n\n  // Bind the store to the manager\n  reducerManager.bindStore(store);\n\n  // Optionally put the reducer manager on the store so it is easily accessible\n  store.reducerManager = reducerManager;\n};\n```\n\n### With Redux Toolkit\n\n```typescript\nimport { ReducerManager } from \"dynux\";\nimport { Reducer } from \"redux\";\nimport { configureStore } from \"@reduxjs/toolkit\";\n\nconst someReducer: Reducer = (state = null) =\u003e state;\nconst initialReducers = {\n  someReducer,\n};\n\nconst configureStore = () =\u003e {\n  // Optionally initialize with static reducers\n  const reducerManager = new ReducerManager(initialReducers);\n\n  // Create a store with the root reducer\n  const store = configureStore({ reducer: reducerManager.reduce });\n\n  // Bind the store to the manager\n  reducerManager.bindStore(store);\n\n  // Optionally put the reducer manager on the store so it is easily accessible\n  store.reducerManager = reducerManager;\n};\n```\n\n## Attaching the manager to store\n\nThe `ReducerManager` instance can be bound to your Redux store\nfor easy access. If you are using TypeScript, include the \n`dynux/augmentation` file, which extends the store object with \na reducerManager property.\n\n```typescript\nimport {} from \"dynux/dist/types/augmentation\";\nimport { ReducerManager } from \"dynux\";\nimport { setupStore } from \"redux\";\n\nconst reducerManager = new ReducerManager();\nconst store = setupStore(reducerManager.reduce);\nreducerManager.bindStore(store);\n\n// ts should not complain about this\nstore.reducerManager = reducerManager;\n```\n\n## Usage\n\nThe exported `ReducerManager` class optionally accepts static reducers \nas a constructor argument. These reducers are always present on your store.\n\n### `bindStore`\n\nBinds a Redux store to a `ReducerManager` instance.\n\n```typescript\nconst manager = new ReducerManager();\n\nmanager.bindStore(createStore(manager.reduce));\n```\n\nA different store can be rebound at any time, and\nall active reducers will be registered on the new store.\n\n```typescript\nconst newStore = createStore(manager.reduce);\n\nmanager.bindStore(newStore);\n```\n\n### `getReducerMap`\n\nReturns the reducers that are currently registered on the store.\n\n### `hasReducer`\n\nChecks if a reducer is registered on the store.\n\n```typescript\nmanager.hasReducer(\"reducerKey\");\n```\n\n### `reduce`\n\nReturns the combined reducers. Pass this to `configureStore` or `setupStore`.\n\n### `add`\n\nAsynchronously adds a new reducer to the store. The reducer is identified \nby a unique key, which helps avoid duplicate reducers and provides a unique \nidentification for each reducer.\n\n```typescript\nmanager.add(\"reducerKey\", reducerImpl);\n```\n\n### `remove`\n\nAsynchronously removes a reducer from the store. You would rarely \nneed to use this method unless you have a very large number of \ndynamic reducers.\n\n```typescript\nmanager.remove(\"reducerKey\");\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzignis%2Fdynux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzignis%2Fdynux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzignis%2Fdynux/lists"}