{"id":15046430,"url":"https://github.com/sixgramwater/redux-lite","last_synced_at":"2026-02-28T20:03:32.808Z","repository":{"id":42527253,"uuid":"476234160","full_name":"sixgramwater/redux-lite","owner":"sixgramwater","description":"A lightweight state management library for React","archived":false,"fork":false,"pushed_at":"2022-04-01T08:52:35.000Z","size":266,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-28T11:54:47.887Z","etag":null,"topics":["library","lightweight","react","react-redux","redux","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sixgramwater.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}},"created_at":"2022-03-31T09:17:48.000Z","updated_at":"2022-09-09T07:52:53.000Z","dependencies_parsed_at":"2022-08-28T14:52:02.548Z","dependency_job_id":null,"html_url":"https://github.com/sixgramwater/redux-lite","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sixgramwater/redux-lite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sixgramwater%2Fredux-lite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sixgramwater%2Fredux-lite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sixgramwater%2Fredux-lite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sixgramwater%2Fredux-lite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sixgramwater","download_url":"https://codeload.github.com/sixgramwater/redux-lite/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sixgramwater%2Fredux-lite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29951085,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T18:42:55.706Z","status":"ssl_error","status_checked_at":"2026-02-28T18:42:48.811Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["library","lightweight","react","react-redux","redux","state-management","zustand"],"created_at":"2024-09-24T20:53:06.003Z","updated_at":"2026-02-28T20:03:32.792Z","avatar_url":"https://github.com/sixgramwater.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redux-lite\n\n\u003e A lightweight state management library for react inspired by redux and react-redux\n\n[![NPM](https://img.shields.io/npm/v/@sixgramwater/redux-lite)](https://www.npmjs.com/package/@sixgramwater/redux-lite) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n## Install\n\n```bash\nnpm install --save @sixgramwater/redux-lite\n```\n\n## Usage\n\n### 1. create a single module\n```jsx\n// store/counter.ts\nimport { fetch } from \"../api\";\n\nconst counterState = {\n  count: 0,\n}\n\n// A single module named: counter\nconst counter = {\n  state: counterState,\n  reducers: {\n    addCounter({ state, payload }) {\n      return {\n        ...state,\n        count: state.count + payload,\n      }\n    }\n  },\n  effects: {\n    // create thunk in effects to dispatch async action\n    asyncAddCounter({dispatch, state, payload}) {\n      fetch(1000).then(value =\u003e {\n        dispatch.counter.addCounter(payload);\n      })  \n    }\n  }\n}\n```\n\n### 2. setup modules and invoke `create()`\n```jsx\n// setup modules and invoke create()\nconst modules = { counter };\nexport const { useModule, dispatch, useSelector } = create(modules);\n```\n\n### 3. get selected state using `useSelector()` hook\n```jsx\n// App.jsx\nimport { useModule, dispatch, useSelector } from './store';\n\nconst App = () =\u003e {\n  // const counterState = useModule('counter');\n  // const count = counterState.count;\n  const count = useSelector('counter', state =\u003e state.count);\n  const handleClick = () =\u003e {\n    dispatch.counter.addCounter(1);\n  }\n\n  const handleAsyncClick = () =\u003e {\n    dispatch.counter.asyncAddCounter(1);\n  }\n  return (\n    \u003cdiv\u003e\n      {count}\n      \u003cbutton onClick={handleClick}\u003eincrease\u003c/button\u003e\n      \u003cbutton onClick={handleAsyncClick}\u003eAsync increase\u003c/button\u003e\n      \n    \u003c/div\u003e\n  )\n}\n```\n\n## Api\n### `create(modules)`\n| Property | Description | Type |\n| :----: | :----: | :----: |\n| modules | A collection of registered modules | {string, Module} |\n\n### `useSelector(moduleName, selector)`\n| Property | Description | Type |\n| :----: | :----: | :----: |\n| moduleName | The name of the module used returns the corresponding status | string |\n| selector | the selector function used to return the exact data you select | Function |\n\n### `dispatch.{moduleName}.{fnName}(payload)`\n| Property | Description | Type |\n| :----: | :----: | :----: |\n| moduleName | The specific module name of the call should be registered in create | string |\n| fnName | The method name of the call module, reducer/effect | string |\n| payload | The load value passed | object |\n\n## License\n\nMIT © [sixgramwater](https://github.com/sixgramwater)\n\n---\n\nThis hook is created using [create-react-hook](https://github.com/hermanya/create-react-hook).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsixgramwater%2Fredux-lite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsixgramwater%2Fredux-lite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsixgramwater%2Fredux-lite/lists"}