{"id":13494626,"url":"https://github.com/pburtchaell/redux-promise-middleware","last_synced_at":"2025-04-10T02:14:31.386Z","repository":{"id":50517967,"uuid":"38990306","full_name":"pburtchaell/redux-promise-middleware","owner":"pburtchaell","description":"Enables simple, yet robust handling of async action creators in Redux","archived":false,"fork":false,"pushed_at":"2023-12-27T19:07:18.000Z","size":1105,"stargazers_count":1983,"open_issues_count":0,"forks_count":187,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-04-10T02:14:26.537Z","etag":null,"topics":["async","async-functions","optimistic-updates","promises","redux"],"latest_commit_sha":null,"homepage":"https://pburtchaell.gitbook.io/redux-promise-middleware/","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/pburtchaell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":"pburtchaell"}},"created_at":"2015-07-13T03:55:34.000Z","updated_at":"2025-03-21T03:16:38.000Z","dependencies_parsed_at":"2024-01-03T01:30:38.992Z","dependency_job_id":null,"html_url":"https://github.com/pburtchaell/redux-promise-middleware","commit_stats":{"total_commits":348,"total_committers":55,"mean_commits":6.327272727272727,"dds":0.3505747126436781,"last_synced_commit":"6dc6b375361c2142ec8c88ed55282243775fbf5a"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pburtchaell%2Fredux-promise-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pburtchaell%2Fredux-promise-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pburtchaell%2Fredux-promise-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pburtchaell%2Fredux-promise-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pburtchaell","download_url":"https://codeload.github.com/pburtchaell/redux-promise-middleware/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248142903,"owners_count":21054671,"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":["async","async-functions","optimistic-updates","promises","redux"],"created_at":"2024-07-31T19:01:26.650Z","updated_at":"2025-04-10T02:14:31.355Z","avatar_url":"https://github.com/pburtchaell.png","language":"JavaScript","funding_links":["https://github.com/sponsors/pburtchaell"],"categories":["JavaScript","Utilities","[Redux](https://github.com/gaearon/redux)","Marks","目录"],"sub_categories":["Side Effects","[React](http://facebook.github.io/react)","[React - A JavaScript library for building user interfaces](http://facebook.github.io/react)","\u003ca id=\"state\"\u003e状态管理\u003c/a\u003e"],"readme":"# Redux Promise Middleware\n\n[![npm downloads](https://img.shields.io/npm/dm/redux-promise-middleware.svg?style=flat)](https://www.npmjs.com/package/redux-promise-middleware)\n\nRedux Promise Middleware enables simple, yet robust handling of async action creators in [Redux](http://redux.js.org). \n\n```js\nconst asyncAction = () =\u003e ({\n  type: 'PROMISE',\n  payload: new Promise(...),\n})\n```\n\nGiven a single action with an async payload, the middleware transforms the action to a separate pending action and a separate fulfilled/rejected action, representing the states of the async action.\n\nThe middleware can be combined with [Redux Thunk](https://github.com/gaearon/redux-thunk) to chain action creators.\n\n```js\nconst secondAction = (data) =\u003e ({\n  type: 'SECOND',\n  payload: {...},\n})\n\nconst firstAction = () =\u003e {\n  return (dispatch) =\u003e {\n    const response = dispatch({\n      type: 'FIRST',\n      payload: new Promise(...),\n    })\n\n    response.then((data) =\u003e {\n      dispatch(secondAction(data))\n    })\n  }\n}\n```\n\n## Documentation and Help\n- [Introduction](/docs/introduction.md)\n- [Guides](/docs/guides/)\n- [Examples](/examples)\n\n**Heads Up:** Version 6 includes some breaking changes. Check the [upgrading guide](docs/upgrading/v6.md) for help.\n\n## Issues\nFor bug reports and feature requests, [file an issue on GitHub](https://github.com/pburtchaell/redux-promise-middleware/issues/new).\n\nFor help, [ask a question on StackOverflow](https://stackoverflow.com/questions/tagged/redux-promise-middleware).\n\n## Releases\n- [Release History](https://github.com/pburtchaell/redux-promise-middleware/releases)\n- [Upgrade from 5.x to 6.0.0](docs/upgrading/v6.md)\n- [Upgrade from 4.x to 5.0.0](docs/upgrading/v5.md)\n- [Upgrade from 3.x to 4.0.0](docs/upgrading/v4.md)\n\nFor older versions:\n- [5.x](https://github.com/pburtchaell/redux-promise-middleware/tree/5.1.1)\n- [4.x](https://github.com/pburtchaell/redux-promise-middleware/tree/4.4.0)\n- [3.x](https://github.com/pburtchaell/redux-promise-middleware/tree/3.3.0)\n- [2.x](https://github.com/pburtchaell/redux-promise-middleware/tree/2.4.0)\n- [1.x](https://github.com/pburtchaell/redux-promise-middleware/tree/1.0.0)\n\n## Maintainers\nPlease reach out to us if you have any questions or comments.\n\nPatrick Burtchaell (pburtchaell):\n- [GitHub](https://github.com/pburtchaell)\n\nThomas Hudspith-Tatham (tomatau):\n- [GitHub](https://github.com/tomatau)\n\n## License\n\n[Code licensed with the MIT License (MIT)](/LICENSE). \n\n[Documentation licensed with the CC BY-NC License](https://creativecommons.org/licenses/by-nc/4.0/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpburtchaell%2Fredux-promise-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpburtchaell%2Fredux-promise-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpburtchaell%2Fredux-promise-middleware/lists"}