{"id":13511347,"url":"https://github.com/ice-lab/icestore","last_synced_at":"2025-04-12T20:43:53.324Z","repository":{"id":34750579,"uuid":"183025024","full_name":"ice-lab/icestore","owner":"ice-lab","description":"🌲 Simple and friendly state for React","archived":false,"fork":false,"pushed_at":"2023-07-31T08:43:13.000Z","size":413,"stargazers_count":399,"open_issues_count":4,"forks_count":34,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-04-03T19:17:07.026Z","etag":null,"topics":["hooks","icestore","react","typescript"],"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/ice-lab.png","metadata":{"files":{"readme":"README.en.md","changelog":"CHANGELOG.md","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":"2019-04-23T13:48:47.000Z","updated_at":"2025-01-25T14:01:11.000Z","dependencies_parsed_at":"2024-06-18T14:02:43.968Z","dependency_job_id":null,"html_url":"https://github.com/ice-lab/icestore","commit_stats":{"total_commits":216,"total_committers":11,"mean_commits":"19.636363636363637","dds":"0.37962962962962965","last_synced_commit":"179c822f690001bd160203b70e35510e55d064cf"},"previous_names":["ice-lab/fiy"],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ice-lab%2Ficestore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ice-lab%2Ficestore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ice-lab%2Ficestore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ice-lab%2Ficestore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ice-lab","download_url":"https://codeload.github.com/ice-lab/icestore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631686,"owners_count":21136555,"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","icestore","react","typescript"],"created_at":"2024-08-01T03:00:47.970Z","updated_at":"2025-04-12T20:43:53.300Z","avatar_url":"https://github.com/ice-lab.png","language":"TypeScript","funding_links":[],"categories":["react","Frameworks","List"],"sub_categories":["State of the React"],"readme":"English | [简体中文](./README.md)\n\n# icestore\n\n\u003e Simple and friendly state for React.\n\n[![NPM version](https://img.shields.io/npm/v/@ice/store.svg?style=flat)](https://npmjs.org/package/@ice/store)\n[![build status](https://github.com/ice-lab/icestore/actions/workflows/ci.yml/badge.svg)](https://github.com/ice-lab/icestore/actions/workflows/ci.yml)\n[![NPM downloads](http://img.shields.io/npm/dm/@ice/store.svg?style=flat)](https://npmjs.org/package/@ice/store)\n[![codecov](https://codecov.io/gh/ice-lab/icestore/branch/master/graph/badge.svg)](https://codecov.io/gh/ice-lab/icestore)\n\n## Versions\n\n| Version | Branch | Docs |\n| --- | --- | --- |\n| V2  | master     |  [Docs](https://github.com/ice-lab/icestore#文档)\n| V1  | stable/1.x |  [Docs](https://github.com/ice-lab/icestore/tree/stable/1.x#documents)\n\n## Introduction\n\nicestore is a simple and friendly state management library for React. It has the following core features:\n\n- **Minimal \u0026 Familiar API**: No additional learning costs, easy to get started with the knowledge of Redux \u0026\u0026 React Hooks.\n- **Built in Async Status**: Records loading and error status of effects, simplifying the rendering logic in the view layer.\n- **Class Component Support**: Make old projects enjoying the fun of lightweight state management with friendly compatibility strategy.\n- **TypeScript Support**: Provide complete type definitions to support intelliSense in VS Code.\n\nSee the [comparison table](docs/recipes.md#能力对比表) for more details.\n\n## Documents\n\n- [API](./docs/api.md)\n- [Recipes](./docs/recipes.md)\n- [Upgrade from V1](./docs/upgrade-guidelines.md)\n- [Q \u0026 A](./docs/qna.md)\n\n## Examples\n\n- [Counter](https://codesandbox.io/s/github/ice-lab/icestore/tree/master/examples/counter)\n- [Todos](https://codesandbox.io/s/github/ice-lab/icestore/tree/master/examples/todos)\n- [Class Component Support](https://codesandbox.io/s/github/ice-lab/icestore/tree/master/examples/classComponent)\n- [withModel](https://codesandbox.io/s/github/ice-lab/icestore/tree/master/examples/withModel)\n\n## Basic example\n\n```jsx\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport { createStore, createModel } from '@ice/store';\n\nconst delay = (time) =\u003e\n  new Promise((resolve) =\u003e setTimeout(() =\u003e resolve(), time));\n\n// 1️⃣ Use a model to define your store\nconst counter = createModel({\n  state: 0,\n  reducers: {\n    increment: (prevState) =\u003e prevState + 1,\n    decrement: (prevState) =\u003e prevState - 1,\n  },\n  effects: () =\u003e ({\n    async asyncDecrement() {\n      await delay(1000);\n      this.decrement();\n    },\n  }),\n});\n\nconst models = {\n  counter,\n};\n\n// 2️⃣ Create the store\nconst store = createStore(models);\n\n// 3️⃣ Consume model\nconst { useModel } = store;\nfunction Counter() {\n  const [count, dispatchers] = useModel('counter');\n  const { increment, asyncDecrement } = dispatchers;\n  return (\n    \u003cdiv\u003e\n      \u003cspan\u003e{count}\u003c/span\u003e\n      \u003cbutton type=\"button\" onClick={increment}\u003e\n        +\n      \u003c/button\u003e\n      \u003cbutton type=\"button\" onClick={asyncDecrement}\u003e\n        -\n      \u003c/button\u003e\n    \u003c/div\u003e\n  );\n}\n\n// 4️⃣ Wrap your components with Provider\nconst { Provider } = store;\nfunction App() {\n  return (\n    \u003cProvider\u003e\n      \u003cCounter /\u003e\n    \u003c/Provider\u003e\n  );\n}\n\nconst rootElement = document.getElementById('root');\nReactDOM.render(\u003cApp /\u003e, rootElement);\n```\n\n## Installation\n\nicestore requires React 16.8.0 or later.\n\n```bash\nnpm install @ice/store --save\n```\n\n## Inspiration\n\nicestore refines and builds upon the ideas of [rematch](https://github.com/rematch/rematch) \u0026 [constate](https://github.com/diegohaz/constate).\n\n## Contributors\n\nFeel free to report any questions as an [issue](https://github.com/ice-lab/icestore/issues/new), we'd love to have your helping hand on icestore.\n\nDevelop:\n\n```bash\n$ cd icestore/\n$ npm install\n$ npm run test\n$ npm run watch\n\n$ cd examples/counter\n$ npm install\n$ npm link ../../                    # link icestore\n$ npm link ../../node_modules/react  # link react\n$ npm start\n```\n\n## License\n\n[MIT](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fice-lab%2Ficestore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fice-lab%2Ficestore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fice-lab%2Ficestore/lists"}