{"id":15046431,"url":"https://github.com/sasa-djuric/zustand-slice","last_synced_at":"2025-10-27T01:30:39.227Z","repository":{"id":42536408,"uuid":"441523996","full_name":"sasa-djuric/zustand-slice","owner":"sasa-djuric","description":"A zustand middleware that provides an API like createSlice from Redux toolkit.","archived":false,"fork":false,"pushed_at":"2023-03-07T00:25:17.000Z","size":620,"stargazers_count":5,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-01T01:25:22.919Z","etag":null,"topics":["middleware","react","reactjs","redux","redux-toolkit","slice","state","state-management","zustand"],"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/sasa-djuric.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-12-24T17:41:50.000Z","updated_at":"2023-07-14T01:14:36.000Z","dependencies_parsed_at":"2024-09-27T17:40:30.838Z","dependency_job_id":"65832b81-1e39-4760-b787-bb89fbae6dde","html_url":"https://github.com/sasa-djuric/zustand-slice","commit_stats":{"total_commits":13,"total_committers":2,"mean_commits":6.5,"dds":0.07692307692307687,"last_synced_commit":"ad23c5c8e1e84d017df3c34bc21ecaa6c64ea531"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasa-djuric%2Fzustand-slice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasa-djuric%2Fzustand-slice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasa-djuric%2Fzustand-slice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasa-djuric%2Fzustand-slice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sasa-djuric","download_url":"https://codeload.github.com/sasa-djuric/zustand-slice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238418230,"owners_count":19468869,"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":["middleware","react","reactjs","redux","redux-toolkit","slice","state","state-management","zustand"],"created_at":"2024-09-24T20:53:06.075Z","updated_at":"2025-10-27T01:30:38.861Z","avatar_url":"https://github.com/sasa-djuric.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zustand-slice\n\nA [zustand](https://github.com/pmndrs/zustand) middleware that provides an API like [createSlice](https://redux-toolkit.js.org/api/createslice) from Redux toolkit.\n\n## Install\n\n```sh\nnpm install zustand-slice\n```\n\nor\n\n```sh\nyarn add zustand-slice\n```\n\n## Usage\n\nCreate a store using slice middleware.\n\n```js\nimport create from 'zustand';\nimport slice from 'zustand-slice';\n\nconst useStore = create(\n  slice({\n    initialState: {\n      bears: 0\n    },\n    reducers: {\n      increasePopulation(state) {\n        return {\n          bears: state.bears + 1\n        };\n      },\n      removeAllBears() {\n        return {\n          bears: 0\n        };\n      }\n    }\n  })\n);\n```\n\nAnd use it as usual.\n\n```jsx\nfunction BearCounter() {\n  const bears = useStore(state =\u003e state.bears);\n  return \u003ch1\u003e{bears} around here ...\u003c/h1\u003e;\n}\n\nfunction Controls() {\n  const increasePopulation = useStore(state =\u003e state.increasePopulation);\n  return \u003cbutton onClick={increasePopulation}\u003eone up\u003c/button\u003e;\n}\n```\n\n## Usage with typescript\n\nBy default, types will be inferred from initialState object and reducers payload, so there is no need to type the whole store explicitly.\n\n## License\n\n[MIT](https://github.com/sasa-djuric/zustand-slice/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsasa-djuric%2Fzustand-slice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsasa-djuric%2Fzustand-slice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsasa-djuric%2Fzustand-slice/lists"}