{"id":19235659,"url":"https://github.com/paripsky/tinystate","last_synced_at":"2025-04-21T05:32:08.513Z","repository":{"id":187907003,"uuid":"677798148","full_name":"paripsky/tinystate","owner":"paripsky","description":"A minimalistic and lightweight state management library for React applications.","archived":false,"fork":false,"pushed_at":"2024-04-09T18:35:41.000Z","size":27,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T12:43:40.860Z","etag":null,"topics":["react","state","state-management"],"latest_commit_sha":null,"homepage":"https://paripsky.github.io/tinystate/","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/paripsky.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":"2023-08-12T17:03:55.000Z","updated_at":"2025-02-13T15:08:54.000Z","dependencies_parsed_at":"2024-11-09T16:17:56.451Z","dependency_job_id":"b99a4881-7cac-40e3-997c-af63154614de","html_url":"https://github.com/paripsky/tinystate","commit_stats":null,"previous_names":["paripsky/tinystate"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paripsky%2Ftinystate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paripsky%2Ftinystate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paripsky%2Ftinystate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paripsky%2Ftinystate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paripsky","download_url":"https://codeload.github.com/paripsky/tinystate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250002273,"owners_count":21359084,"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","state","state-management"],"created_at":"2024-11-09T16:17:45.172Z","updated_at":"2025-04-21T05:32:08.259Z","avatar_url":"https://github.com/paripsky.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tinystate - Tiny React State Management Library\n\n**tinystate** is a super small state management solution for React applications.\nIt provides a simple and efficient way to manage and share state across your\ncomponents without the complexity of larger state management libraries. With\njust a few lines of code, you can integrate **tinystate** into your React\nproject and start managing your application's state effortlessly.\n\n## Bundle Size\n\n[Check out on bundlephobia](https://bundlephobia.com/package/tinystate-react)\n\n## Installation\n\nYou can install **tinystate** using npm or yarn:\n\n```bash\nnpm install tinystate-react\n# or\nyarn add tinystate-react\n# or\npnpm install tinystate-react\n```\n\n## Usage\nCreate your useStore hook: \n\n```javascript\nimport { createUseStore } from \"tinystate-react\";\n\nexport const useCountStore = createUseStore(0);\n```\n\nNow, you can use the `useCountStore` hook in your components to access and\nupdate the state:\n\n```javascript\nimport { useCountStore } from \"./useCountStore\";\n\nfunction Counter() {\n  const [count, setCount] = useCountStore();\n\n  const increment = () =\u003e {\n    setCount(count + 1);\n  };\n\n  const decrement = () =\u003e {\n    setCount(count - 1);\n  };\n\n  return (\n    \u003cdiv\u003e\n      \u003cp\u003eCount: {count}\u003c/p\u003e\n      \u003cbutton onClick={increment}\u003eIncrement\u003c/button\u003e\n      \u003cbutton onClick={decrement}\u003eDecrement\u003c/button\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\n### API Reference\n\n#### `createUseStore(initialState: T)`\n\nCreates a custom hook that encapsulates the store's subscription and state\nmanagement.\n\n- `initialState` (T): The initial state of the store.\n\nReturns a hook that, when called, returns a tuple containing (Similar to useState):\n\n- The current state.\n- A setter function to update the state.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparipsky%2Ftinystate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparipsky%2Ftinystate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparipsky%2Ftinystate/lists"}