{"id":19755258,"url":"https://github.com/paramsinghvc/redux-hooks","last_synced_at":"2026-04-13T06:01:34.401Z","repository":{"id":35136524,"uuid":"187361509","full_name":"paramsinghvc/redux-hooks","owner":"paramsinghvc","description":"A lightweight React hook for using Redux","archived":false,"fork":false,"pushed_at":"2023-01-07T05:35:51.000Z","size":757,"stargazers_count":0,"open_issues_count":12,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-11T02:18:03.783Z","etag":null,"topics":["hooks","javascript","react","redux","typescript","webpack"],"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/paramsinghvc.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}},"created_at":"2019-05-18T13:30:44.000Z","updated_at":"2019-11-12T02:43:24.000Z","dependencies_parsed_at":"2023-01-15T14:33:46.677Z","dependency_job_id":null,"html_url":"https://github.com/paramsinghvc/redux-hooks","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paramsinghvc%2Fredux-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paramsinghvc%2Fredux-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paramsinghvc%2Fredux-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paramsinghvc%2Fredux-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paramsinghvc","download_url":"https://codeload.github.com/paramsinghvc/redux-hooks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241086278,"owners_count":19907273,"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":["hooks","javascript","react","redux","typescript","webpack"],"created_at":"2024-11-12T03:09:49.818Z","updated_at":"2026-04-13T06:01:29.359Z","avatar_url":"https://github.com/paramsinghvc.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- PROJECT SHIELDS --\u003e\n\n[![Build Status][build-shield]]()\n[![MIT License][license-shield]][license-url]\n[![Contributors][contributors-shield]]()\n\u003cimg src=\"https://img.badgesize.io/paramsinghvc/redux-hooks/master/dist/index.js?compression=gzip\u0026label=gzip+size\u0026max=3000\u0026softmax=2000\"\u003e\n[![LinkedIn][linkedin-shield]][linkedin-url]\n\n\u003c!-- PROJECT LOGO --\u003e\n\u003cbr /\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/paramsinghvc/redux-hooks\"\u003e\n    \u003cimg src=\"https://user-images.githubusercontent.com/4329912/57970576-72d80a00-79a0-11e9-81c3-57465a997044.png\" alt=\"Logo\" width=\"80\" height=\"80\"\u003e\n  \u003c/a\u003e\n\n  \u003ch3 align=\"center\"\u003euseRedux React Hook\u003c/h3\u003e\n\n  \u003cp align=\"center\"\u003e\n    Making redux easy to use with React Hooks Api\n    \u003cbr /\u003e\n    \u003ca href=\"https://www.npmjs.com/package/@mollycule/redux-hook\"\u003e\u003cstrong\u003eExplore the docs »\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://codesandbox.io/s/typescript-redux-3bb54?fontsize=14\"\u003eView Demo\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/paramsinghvc/redux-hooks/issues\"\u003eReport Bug\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/paramsinghvc/redux-hooks/issues\"\u003eRequest Feature\u003c/a\u003e\n    .\n    \u003ca href=\"https://www.npmjs.com/package/@mollycule/redux-hook\"\u003eNPM Link\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\n\u003c!-- TABLE OF CONTENTS --\u003e\n\n## Table of Contents\n\n- [About the Project](#about-the-project)\n  - [Built With](#built-with)\n- [Getting Started](#getting-started)\n  - [Prerequisites](#prerequisites)\n  - [Installation](#installation)\n- [Usage](#usage)\n- [Contributing](#contributing)\n- [License](#license)\n- [Contact](#contact)\n- [Acknowledgements](#acknowledgements)\n\n\u003c!-- ABOUT THE PROJECT --\u003e\n\n## About The Project\n\n[![Product Name Screen Shot][product-screenshot]](https://example.com)\n\n[React Hooks Api](https://reactjs.org/docs/hooks-intro.html) has introduced a cleaner and easy way of writing React Components ever. But using Redux in hooks way is not there. Hence, useRedux is a way of using Redux in the hooks way. It's a sort of connect function using hooks api.\n\n### Built With\n\n- [TypeScript](https://www.typescriptlang.org/)\n- [Webpack](https://webpack.js.org/)\n\n\u003c!-- GETTING STARTED --\u003e\n\n## Getting Started\n\n### Prerequisites\n\nFollowing Peer Dependencies are required for using redux-hooks package:\n\n- react: \"^16.8.6\",\n- redux: \"^4.0.1\"\n\n### Installation\n\n```sh\nnpm i @mollycule/redux-hook -S\n```\n\n\u003c!-- USAGE EXAMPLES --\u003e\n\n## Usage\n\n1. Wrap the root app component with `redux-hook` provider by calling `createStoreContext\u003cIRootState\u003e` while specifying the shape of Redux App RootState into Generic Parameter.\n\n```tsx\nimport { createStoreContext } from \"@mollycule/redux-hook\";\n\nconst { Provider } = createStoreContext\u003cIRootState\u003e();\n\nclass App extends Component {\n  render() {\n    return (\n      \u003cProvider store={store}\u003e\n        \u003cMainComponent /\u003e\n      \u003c/Provider\u003e\n    );\n  }\n}\n\nexport default App;\n```\n\n2. Now, we can simply use the `useRedux` hook anywhere in our app functional components as\n\n```tsx\nimport useRedux from \"@mollycule/redux-hook\";\nimport { incrementCount, decrementCount, setIsLoading } from \"./actions\";\n\nconst MyComponent = props =\u003e {\n  const mapStateToProps = state =\u003e ({\n    count: state.count,\n    isLoading: state.isLoading\n  });\n  const mapDispatchToProps = {\n    incrementCount,\n    decrementCount,\n    setIsLoading\n  };\n  const mappedProps = useRedux(mapStateToProps, mapDispatchToProps);\n  const { count, incrementCounter, setIsLoading } = mappedProps;\n  return (\n    \u003cp onClick={incrementCount} onMouseOver={() =\u003e setIsLoading(true)}\u003e\n      {count}\n    \u003c/p\u003e\n  );\n};\n```\n\n**Note**: For `mapDispatchToProps`, we can pass a normal function as well that accepts dispatch and returns an object of dispatch bound actions from it as\n\n```ts\nconst mapDispatchToProps = dispatch =\u003e ({\n  authenticateUser: () =\u003e {\n    dispatch({\n      type: \"AUTHENTICATE_USER\"\n    });\n  },\n  setIsLoading: (status: boolean) =\u003e {\n    dispatch(setIsLoading(status));\n  }\n});\n```\n\nPassing simply an object of actions, automatically bind them to dispatch using redux [`bindActionCreators`](https://redux.js.org/api/bindactioncreators). Also, you can even skip the second paramter of useRedux hook if you just want to access the props from the store.\n\n\u003c!-- CONTRIBUTING --\u003e\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n\u003c!-- LICENSE --\u003e\n\n## License\n\nDistributed under the MIT License. See `LICENSE` for more information.\n\n\u003c!-- CONTACT --\u003e\n\n## Contact\n\nParam Singh - [@paramsinghvc](https://github.com/paramsinghvc) - paramsinghvc@gmail.com\n\nProject Link: [https://github.com/paramsinghvc/redux-hooks](https://github.com/paramsinghvc/redux-hooks)\n\n\u003c!-- ACKNOWLEDGEMENTS --\u003e\n\n## Acknowledgements\n\n- [GitHub Emoji Cheat Sheet](https://www.webpagefx.com/tools/emoji-cheat-sheet)\n- [Img Shields](https://shields.io)\n\n\u003c!-- MARKDOWN LINKS \u0026 IMAGES --\u003e\n\n[build-shield]: https://img.shields.io/badge/build-passing-brightgreen.svg?style=flat\n[contributors-shield]: https://img.shields.io/badge/contributors-1-orange.svg?style=flat\n[license-shield]: https://img.shields.io/badge/license-MIT-blue.svg?style=flat\n[license-url]: https://choosealicense.com/licenses/mit\n[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=flat\u0026logo=linkedin\u0026colorB=0077B5\n[linkedin-url]: https://www.linkedin.com/in/paramsinghvc\n[product-screenshot]: https://user-images.githubusercontent.com/4329912/57970750-b895d200-79a2-11e9-9fdf-fcf80c8fce28.png\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparamsinghvc%2Fredux-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparamsinghvc%2Fredux-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparamsinghvc%2Fredux-hooks/lists"}