{"id":18085165,"url":"https://github.com/xrr2016/rematch-todos","last_synced_at":"2025-04-12T20:11:47.221Z","repository":{"id":57218766,"uuid":"73338095","full_name":"xrr2016/rematch-todos","owner":"xrr2016","description":"React Rematch Todos Example","archived":false,"fork":false,"pushed_at":"2018-03-16T23:56:22.000Z","size":1573,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T20:03:13.502Z","etag":null,"topics":["react","react-redux","rematch"],"latest_commit_sha":null,"homepage":"","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/xrr2016.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":"2016-11-10T01:59:28.000Z","updated_at":"2019-04-02T09:07:48.000Z","dependencies_parsed_at":"2022-08-29T02:11:35.017Z","dependency_job_id":null,"html_url":"https://github.com/xrr2016/rematch-todos","commit_stats":null,"previous_names":["xrr2016/easy-upload"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xrr2016%2Frematch-todos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xrr2016%2Frematch-todos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xrr2016%2Frematch-todos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xrr2016%2Frematch-todos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xrr2016","download_url":"https://codeload.github.com/xrr2016/rematch-todos/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625493,"owners_count":21135513,"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-redux","rematch"],"created_at":"2024-10-31T15:09:43.028Z","updated_at":"2025-04-12T20:11:47.185Z","avatar_url":"https://github.com/xrr2016.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🔥 Rematch Todos Demo 🔥\n\n[![GitHub issues](https://img.shields.io/github/issues/xrr2016/rematch-todos.svg?style=flat-square)](https://github.com/xrr2016/rematch-todos/issues) [![Build](https://travis-ci.org/xrr2016/rematch-todos.svg?branch=master)]()\n\n## Why\n\n这个项目起因是为了尝试一下[rematch](https://github.com/rematch/rematch/)，它是一个基于 Redux 的状态管理框架，感觉跟 Vuex 有点相似，用以来比 Redux 简便很多，核心就是 model，dispatch 和 reducers，比 Redux 更好理解, 且无需配置就可使用 [Redux Devtools](https://github.com/zalmoxisus/redux-devtools-extension) 与 [reactotron](https://github.com/zalmoxisus/redux-devtools-extension)。\n\n## First step\n\n定义你的 model, 然后用 init 方法初始化。\n\n```js\n// todos.js\nexport const todos = {\n  state: [],\n  reducers: {\n    addTodo () {...},\n    removeTodo () {...},\n    editTodo () {...}\n  },\n  effects: {\n    async loadToads () {...}\n  }\n}\n// index.js\n\nimport { init } from '@rematch/core'\nimport { todos } from 'path/todos'\n\nconst store = init({\n  models: {\n    todos\n  }\n})\n```\n\n## Second step\n\n将 store 用 Provider 赋予 App, 在 container 组件中调用 dispatch 方法, 让你定义的 reducers 响应 action 以更新 state。\n\n```js\n;\u003cProvider store={store}\u003e\n  \u003cApp /\u003e\n\u003c/Provider\u003e\n\n// todoInput\nimport { dispatch } from '@rematch/core'\n\ndispatch.todos.addTodo(newTodo)\n// or\ndispatch({ type: 'todos/removeTodo', todoId })\n\n// \b\bYou done！\n```\n\n## Compare\n\n![compare](./redux-vs-rematch.png)\n\n## [Live Demo](https://xrr2016.github.io/rematch-todos)\n\n![demo](./rematch-todos.png)\n\n## Usage\n\n```sh\ngit clone git@github.com:xrr2016/rematch-todos.git\n\ncd rematch-todos \u0026\u0026 yarn\n\nyarn build\n\nserve -s build\n```\n\n## Reference\n\n[Redux](http://www.redux.org.cn/)\n[Rematch](https://rematch.gitbooks.io/rematch/#getting-started)\n[React-redux](https://redux.js.org/basics/usage-with-react)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxrr2016%2Frematch-todos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxrr2016%2Frematch-todos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxrr2016%2Frematch-todos/lists"}