{"id":16529258,"url":"https://github.com/evgenyorekhov/actus","last_synced_at":"2025-03-21T09:31:44.302Z","repository":{"id":39259643,"uuid":"233394632","full_name":"EvgenyOrekhov/actus","owner":"EvgenyOrekhov","description":"Minimalist, boilerplate-free, framework-agnostic state container","archived":false,"fork":false,"pushed_at":"2023-03-01T11:07:54.000Z","size":4678,"stargazers_count":2,"open_issues_count":20,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-30T09:06:06.218Z","etag":null,"topics":["redux","state","state-container","state-management","state-manager"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/actus","language":"JavaScript","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/EvgenyOrekhov.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":"2020-01-12T13:12:13.000Z","updated_at":"2024-08-21T15:25:01.284Z","dependencies_parsed_at":"2024-08-21T15:35:02.032Z","dependency_job_id":null,"html_url":"https://github.com/EvgenyOrekhov/actus","commit_stats":{"total_commits":515,"total_committers":4,"mean_commits":128.75,"dds":0.6,"last_synced_commit":"dc6a37fb0ffeb3e78e7acc86166a38d24b328a79"},"previous_names":[],"tags_count":116,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvgenyOrekhov%2Factus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvgenyOrekhov%2Factus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvgenyOrekhov%2Factus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvgenyOrekhov%2Factus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EvgenyOrekhov","download_url":"https://codeload.github.com/EvgenyOrekhov/actus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244772034,"owners_count":20507909,"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":["redux","state","state-container","state-management","state-manager"],"created_at":"2024-10-11T17:44:16.121Z","updated_at":"2025-03-21T09:31:43.886Z","avatar_url":"https://github.com/EvgenyOrekhov.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# actus\n\nMinimalist, boilerplate-free, framework-agnostic state container\n\n[![npm version](https://img.shields.io/npm/v/actus.svg?style=flat-square)](https://www.npmjs.com/package/actus)\n\n- **Simple** - it takes 2 minutes to learn\n- **Boilerplate-free**\n  - comes with built-in default actions (`set()`, `reset()`, `toggle()`,\n    `merge()`, etc.)\n  - handles loading and error states for async actions for you\n- **Framework-agnostic**\n\n## Examples\n\n### React Counter App\n\n```js\nimport { actus } from \"actus\";\nimport React from \"react\";\nimport ReactDOM from \"react-dom\";\n\nactus({\n  state: 0,\n  subscribers: [\n    ({ state, actions }) =\u003e {\n      ReactDOM.render(\n        \u003c\u003e\n          \u003ch1\u003e{state}\u003c/h1\u003e\n          \u003cbutton onClick={actions.increment}\u003e+\u003c/button\u003e\n          \u003cbutton onClick={actions.decrement}\u003e-\u003c/button\u003e\n        \u003c/\u003e,\n        document.querySelector(\"#root\")\n      );\n    },\n  ],\n});\n```\n\n[Try it on CodeSandbox](https://codesandbox.io/s/actusreact-counter-app-example-y4p8e)\n\n## API\n\n```js\nimport { actus } from \"actus\";\n\n// actus() returns actions bound to the current state, in case if you need them\n// outside of subscribers:\nconst actions = actus({\n  // The initial state:\n  state: { number: 0 },\n\n  // Actions accept an optional payload and the current state, and must return\n  // a new state:\n  actions: {\n    number: {\n      add: ({ state, payload }) =\u003e state + payload,\n    },\n  },\n\n  // Subscribers will be called sequentially during initialization and then\n  // after any action call:\n  subscribers: [({ state, actions, actionName, payload }) =\u003e {}],\n});\n\n// The first argument is the payload:\nactions.number.add(1);\n```\n\n## Plugins\n\nThe following plugins are enabled automatically (but can be redefined manually\nif needed):\n\n- [defaultActions](https://github.com/EvgenyOrekhov/actus/tree/master/packages/actus/src/plugins/defaultActions) - basic actions for your state properties (`set()`, `reset()`, `toggle()`, `merge()`, etc.)\n- [logger](https://github.com/EvgenyOrekhov/actus/tree/master/packages/actus/src/plugins/logger) - logs actions and state changes to your console\n- [freeze](https://github.com/EvgenyOrekhov/actus/tree/master/packages/actus/src/plugins/freeze) - deep freezes your state to prevent mutations\n- [actus-redux-devtools](https://github.com/EvgenyOrekhov/actus/tree/master/packages/actus-redux-devtools) - use [Redux DevTools Extension](https://github.com/zalmoxisus/redux-devtools-extension) with actus\n\nOther plugins that can be enabled manually:\n\n- [persist](https://github.com/EvgenyOrekhov/actus/tree/master/packages/actus/src/plugins/persist) - persists state to a synchronous storage (`localStorage` by default)\n- [actus-state-validator](https://github.com/EvgenyOrekhov/actus/tree/master/packages/actus-state-validator) - state validator and normalizer powered by [joi](https://github.com/hapijs/joi)\n\n## Frameworks\n\n- [actus-ember](https://github.com/EvgenyOrekhov/actus/tree/master/packages/actus-ember)\n- [actus-react](https://github.com/EvgenyOrekhov/actus/tree/master/packages/actus-react)\n\n## Acknowledgements\n\nSources of inspiration:\n\n- https://github.com/reduxjs/redux\n- https://github.com/jorgebucaran/hyperapp\n\n## [Changelog](https://github.com/EvgenyOrekhov/actus/releases)\n\n## License\n\n[MIT](/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevgenyorekhov%2Factus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevgenyorekhov%2Factus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevgenyorekhov%2Factus/lists"}