{"id":35094545,"url":"https://github.com/hodev-dev/restatejs","last_synced_at":"2026-05-21T03:33:17.980Z","repository":{"id":105988852,"uuid":"309438368","full_name":"hodev-dev/restatejs","owner":"hodev-dev","description":"restatejs is new global state management library for react which focus on simplicity and productivity.restatejs is context-less so you don't need to wrap your react app in Provider or Context.","archived":false,"fork":false,"pushed_at":"2020-11-02T18:20:48.000Z","size":255,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-29T07:23:47.748Z","etag":null,"topics":[],"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/hodev-dev.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-11-02T17:03:31.000Z","updated_at":"2020-11-04T02:20:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"8fc14b3d-397b-4662-8e12-992faff2b8a0","html_url":"https://github.com/hodev-dev/restatejs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hodev-dev/restatejs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hodev-dev%2Frestatejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hodev-dev%2Frestatejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hodev-dev%2Frestatejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hodev-dev%2Frestatejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hodev-dev","download_url":"https://codeload.github.com/hodev-dev/restatejs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hodev-dev%2Frestatejs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33287476,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-21T02:57:32.698Z","status":"ssl_error","status_checked_at":"2026-05-21T02:57:31.990Z","response_time":62,"last_error":"SSL_read: 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":[],"created_at":"2025-12-27T15:06:07.499Z","updated_at":"2026-05-21T03:33:17.974Z","avatar_url":"https://github.com/hodev-dev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# restatejs\nrestatejs is new global state management library for react which focus on simplicity and productivity.restatejs is context-less so you don't need to wrap your react app in Provider or Context.\n- restatejs is context-less\n- restatejs is controller for manage code\n- restatejs supports persist state \n- restate js supports async (like redux-thunk) and *generators (like redux-saga)\n- restatejs uses default react useState() hook under the hood so no need other debuging extentions\n# install\n```bash\nnpm install  @hodev/restatejs\n```\nOr\n```bash\nyarn add @hodev/restatejs\n```\n# How To Use:\n\n- create controllers folder\n- make controller\n- create group\n- add multi controller to the group\n- export group\n\n##  make controller\n\n```ts\nimport { Group, IBasicController, IController, IGroup } from '@hodev/restatejs';\n\nconst counterController: IBasicController = {\n  name: 'counterController',\n  default: 0,\n  methods: {\n    inc: (controller: IController, group: IGroup, input: any, state: any) =\u003e {\n      controller.setState(state + 1);\n    }\n  }\n}\n\nconst counterGroup: IGroup = new Group(localStorage);\n\ncounterGroup.add([counterController]);\n\nexport { counterGroup };\n```\n# React Hoook\nimport group that you just created\n```ts\nimport { counterGroup } from './controller/counterController';\n```\nimport useController\n```ts\nimport { useController } from '@hodev/restatejs';\n```\npass group and name of the controller you wnat to connect\n```ts\n  const [state,status] = useController(counterGroup, 'counterController');\n```\nif gives you state and status of state of controller\nstate has 3 state\n- LOADING : 0\n- SUCCESS:1\n- FAILED: 2\n```ts\nimport {statusTypes} from '@hodev/restatejs'\n```\nthen you can use then like this:\n```ts\n(status === statusTypes.LOADING) ? \"do soemthing\" : \"do somethign else\"\n```\n## component will get connected like this\n```ts\nimport { useController } from '@hodev/restatejs';\nimport React from 'react';\nimport { counterGroup } from './controller/counterController';\n\nfunction App() {\n  const [counter] = useController(counterGroup, 'counterController');\n  return (\n    \u003cdiv className=\"App\"\u003e\n      \u003ch1\u003e{counter}\u003c/h1\u003e\n    \u003c/div\u003e\n  );\n}\n\nexport default App;\n\n```\n\n# Run Method\ngroup has run() method but it has it's own way to run method.\nas you see firstly we pass string which contain name of the controller (here is counterController) and we put method name that we want to run after `@`\n### inc is function we decleared inside our controller  \n```ts\n counterGroup.run('counterController@inc', [], counter);\n```\n\n```tsx\nimport { useController } from '@hodev/restatejs';\nimport React from 'react';\nimport { counterGroup } from './controller/counterController';\n\nfunction App() {\n  const [counter] = useController(counterGroup, 'counterController');\n\n  const inc = () =\u003e {\n    counterGroup.run('counterController@inc', [], counter);\n  }\n  return (\n    \u003cdiv className=\"App\"\u003e\n      \u003ch1\u003e{counter}\u003c/h1\u003e\n      \u003cbutton onClick={inc}\u003eincreament\u003c/button\u003e\n    \u003c/div\u003e\n  );\n}\n\nexport default App;\n```\n\n# persist data\n**react native** \n- async storage\n\n**web browser**\n- localStorage\n\nit should be passed to group constructor \nexample:\nfor web\n```ts\nconst counterGroup: IGroup = new Group(localStorage);\n```\nor\nfor react native\n```ts\nconst counterGroup: IGroup = new Group(AsyncStorage);\n```\nthen \n\nto persist data just add persist key to your controller then `restatejs` does the job \n```ts\n{\n   name: 'counterController',\n  \"default\": 0,\n  persist: true, \u003c= here\n  methods: {\n    inc: (controller: IController, group: IGroup, input: any, state: any) =\u003e {\n      controller.setState(state + 1);\n    }\n  }\n}\n```\n# typescirpt\n\n```ts\nconst {IBasicController, IController, IGroup} from '@hodev/restatejs'\n```\ntypescript is fully supported","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhodev-dev%2Frestatejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhodev-dev%2Frestatejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhodev-dev%2Frestatejs/lists"}