{"id":27133205,"url":"https://github.com/twocatmoon/react-actions","last_synced_at":"2026-05-06T19:09:49.360Z","repository":{"id":41061861,"uuid":"479148444","full_name":"twocatmoon/react-actions","owner":"twocatmoon","description":"A dead-simple and boiler-plate free state management strategy for React.","archived":false,"fork":false,"pushed_at":"2024-04-23T14:54:49.000Z","size":322,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"trunk","last_synced_at":"2025-03-23T07:13:09.860Z","etag":null,"topics":["react","react-hooks","react-state-management","redux","state-management","store"],"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/twocatmoon.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":"2022-04-07T21:06:25.000Z","updated_at":"2024-04-23T14:54:53.000Z","dependencies_parsed_at":"2022-09-15T00:51:26.289Z","dependency_job_id":null,"html_url":"https://github.com/twocatmoon/react-actions","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/twocatmoon%2Freact-actions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twocatmoon%2Freact-actions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twocatmoon%2Freact-actions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twocatmoon%2Freact-actions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twocatmoon","download_url":"https://codeload.github.com/twocatmoon/react-actions/tar.gz/refs/heads/trunk","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247744325,"owners_count":20988784,"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":["react","react-hooks","react-state-management","redux","state-management","store"],"created_at":"2025-04-07T23:19:52.988Z","updated_at":"2026-05-06T19:09:49.320Z","avatar_url":"https://github.com/twocatmoon.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv id=\"top\"\u003e\u003c/div\u003e\n\n[![Contributors][contributors-shield]][contributors-url]\n[![Forks][forks-shield]][forks-url]\n[![Stargazers][stars-shield]][stars-url]\n[![Issues][issues-shield]][issues-url]\n[![MIT License][license-shield]][license-url]\n\n\n\n\u003c!-- PROJECT LOGO --\u003e\n\u003cbr /\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003c!-- \u003ca href=\"https://github.com/twocatmoon/react-actions\"\u003e\n    \u003cimg src=\"images/logo.png\" alt=\"Logo\" width=\"80\" height=\"80\"\u003e\n  \u003c/a\u003e --\u003e\n\n  \u003ch3 align=\"center\"\u003eReact Actions\u003c/h3\u003e\n\n  \u003cp align=\"center\"\u003e\n    A dead-simple and boiler-plate free state management strategy for React.\n    \u003cbr /\u003e\n    \u003ca href=\"https://twocatmoon.github.io/react-actions\"\u003e\u003cstrong\u003eExplore the docs »\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/twocatmoon/react-actions/issues\"\u003eReport Bug\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/twocatmoon/react-actions/issues\"\u003eRequest Feature\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n\n\n\u003c!-- TABLE OF CONTENTS --\u003e\n\u003cdetails\u003e\n  \u003csummary\u003eTable of Contents\u003c/summary\u003e\n  \u003col\u003e\n    \u003cli\u003e\n      \u003ca href=\"#about-the-project\"\u003eAbout The Project\u003c/a\u003e\n      \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"#built-with\"\u003eBuilt With\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#contributing\"\u003eContributing\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#contact\"\u003eContact\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#acknowledgments\"\u003eAcknowledgments\u003c/a\u003e\u003c/li\u003e\n  \u003c/ol\u003e\n\u003c/details\u003e\n\n\n\n\u003c!-- ABOUT THE PROJECT --\u003e\n## About The Project\n\nState management in React doesn't need to be complicated. Built using the Context API and useReducer hook, React Actions provides a straight-forward pattern for designing, manipulating, and caching state across your application. \n\nExample using React's Context API:\n\n```tsx\n// store.ts\n\ntype State = {\n    counter: number\n}\n\nconst initialState = {\n    counter: 0\n}\n\nexport const actions = {\n    incrementCounter: action\u003cState, number\u003e((prevState, amount) =\u003e {\n        return {\n            ...prevState,\n            counter: prevState.counter + amount\n        }\n    })\n}\n\nconst options: CreateStoreOptions = {\n    storageKey: 'myStore',\n    storageType: 'local'\n}\n\nexport const { Provider, useStore } = createStoreContext\u003cState\u003e(initialState, actions, options)\n\n// App.tsx\n\nimport { Provider, useStore, actions } from './store.ts'\n\nfunction Consumer () {\n    const [ state, dispatch, _execute, clearStorage ] = useStore()\n\n    return (\n        \u003cdiv\u003e\n            \u003cp\u003eCounter: \u003ccode\u003e{state.counter}\u003c/code\u003e\u003c/p\u003e\n            \u003cp\u003e\n                \u003cbutton onClick={() =\u003e dispatch(actions.incrementCounter(2))}\u003e\n                    Increment Counter by 2\n                \u003c/button\u003e\n            \u003c/p\u003e\n            \u003cp\u003e\n                \u003cbutton onClick={() =\u003e clearStorage()}\u003eClear Local Storage\u003c/button\u003e\n            \u003c/p\u003e\n        \u003c/div\u003e\n    )\n}\n\nfunction App () {\n    return (\n        \u003cProvider\u003e\n            \u003cConsumer /\u003e\n        \u003c/Provider\u003e\n    )\n}\n```\n\nExample using an event bus:\n\n```tsx\n// store.ts\n\ntype State = {\n    counter: number\n}\n\nconst initialState = {\n    counter: 0\n}\n\nexport const actions = {\n    incrementCounter: action\u003cState, number\u003e((prevState, amount) =\u003e {\n        return {\n            ...prevState,\n            counter: prevState.counter + amount\n        }\n    })\n}\n\nconst options: CreateStoreOptions = {\n    storageKey: 'myStore',\n    storageType: 'local'\n}\n\nexport const { useStore } = createStoreEventBus\u003cState\u003e(initialState, actions, options)\n\n// App.tsx\n\nimport { useStore, actions } from './store.ts'\n\nfunction App () {\n    const [ state, dispatch, _execute, clearStorage ] = useStore()\n\n    return (\n        \u003cdiv\u003e\n            \u003cp\u003eCounter: \u003ccode\u003e{state.counter}\u003c/code\u003e\u003c/p\u003e\n            \u003cp\u003e\n                \u003cbutton onClick={() =\u003e dispatch(actions.incrementCounter(2))}\u003e\n                    Increment Counter by 2\n                \u003c/button\u003e\n            \u003c/p\u003e\n            \u003cp\u003e\n                \u003cbutton onClick={() =\u003e clearStorage()}\u003eClear Local Storage\u003c/button\u003e\n            \u003c/p\u003e\n        \u003c/div\u003e\n    )\n}\n\nexport default App\n```\n\nExample using asynchronous Action Sets:\n\n```tsx\n// store.ts\n\nconst { useStore } = createStoreEventBus\u003cState\u003e(initialState, actions, options)\nconst { useStore } = createStoreEventBus\u003cState\u003e(initialState, actions, options)\n\n// Component.tsx\n\nfunction Component () {\n    const [ state, dispatch, execute ] = useStore()\n    execute(actionSets.fetchCounterData(2))\n     \n    ...\n}\n```\n\nExample with Server Side Rendering (SSR) support:\n\n```tsx\nconst options: CreateStoreOptions = {\n    ssr: true\n}\n```\n\nFor a list of all the options that can be passed into `createStoreContext` and `createStoreEventBus`, please see the [documentation](https://twocatmoon.github.io/react-actions/modules.html#CreateStoreOptions).\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\n### Built With\n\n* [React.js](https://reactjs.org/)\n* [TypeScript](https://www.typescriptlang.org/)\n* [Vite](https://vitejs.dev/)\n* [TypeDoc](https://typedoc.org/)\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\n\u003c!-- INSTALLATION --\u003e\n## Installation\n\n1. Install from NPM\n   ```sh\n   npm i @twocatmoon/react-actions\n   ```\n2. Include in your project\n   ```ts\n   import { action, createStoreContext } from '@twocatmoon/react-actions'\n   - or -\n   import { action, createStoreEventBus } from '@twocatmoon/react-actions'\n   ```\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\n\u003c!-- USAGE EXAMPLES --\u003e\n## Usage\n\n_Please refer to the [Documentation](https://twocatmoon.github.io/react-actions)_\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\n\u003c!-- CONTRIBUTING --\u003e\n## Contributing\n\nContributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.\n\nIf you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag \"enhancement\".\nDon't forget to give the project a star! Thanks again!\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\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\n\u003c!-- LICENSE --\u003e\n## License\n\nDistributed under the MIT License. See `LICENSE` for more information.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\n\u003c!-- CONTACT --\u003e\n## Contact\n\nTwitter - [@twocatmoon](https://twitter.com/twocatmoon)\n\nProject Link - [https://github.com/twocatmoon/react-actions](https://github.com/twocatmoon/react-actions)\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\n\u003c!-- ACKNOWLEDGMENTS --\u003e\n## Acknowledgments\n\n* [Best-README-Template](https://github.com/othneildrew/Best-README-Template)\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\n\u003c!-- MARKDOWN LINKS \u0026 IMAGES --\u003e\n\u003c!-- https://www.markdownguide.org/basic-syntax/#reference-style-links --\u003e\n[contributors-shield]: https://img.shields.io/github/contributors/twocatmoon/react-actions.svg?style=for-the-badge\n[contributors-url]: https://github.com/twocatmoon/react-actions/graphs/contributors\n[forks-shield]: https://img.shields.io/github/forks/twocatmoon/react-actions.svg?style=for-the-badge\n[forks-url]: https://github.com/twocatmoon/react-actions/network/members\n[stars-shield]: https://img.shields.io/github/stars/twocatmoon/react-actions.svg?style=for-the-badge\n[stars-url]: https://github.com/twocatmoon/react-actions/stargazers\n[issues-shield]: https://img.shields.io/github/issues/twocatmoon/react-actions.svg?style=for-the-badge\n[issues-url]: https://github.com/twocatmoon/react-actions/issues\n[license-shield]: https://img.shields.io/github/license/twocatmoon/react-actions.svg?style=for-the-badge\n[license-url]: https://github.com/twocatmoon/react-actions/blob/trunk/LICENSE","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwocatmoon%2Freact-actions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwocatmoon%2Freact-actions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwocatmoon%2Freact-actions/lists"}