{"repo":"dai-shi/use-reducer-async","free":true,"listed":false,"github":"https://github.com/dai-shi/use-reducer-async","clone":"git clone https://github.com/dai-shi/use-reducer-async.git","description":"React useReducer with async actions","language":"TypeScript","stars":184,"topics":["react","reactjs","use-reducer","async-actions","dispatch","async","react-hooks"],"license":"MIT","category":"ui-components","readme_excerpt":"use-reducer-async React useReducer with async actions Introduction React useReducer doesn't support async actions natively. Unlike Redux, there's no middleware interface, but hooks are composable. This is a tiny library to extend useReducer's dispatch so that dispatching async actions invoke async functions. Install Usage Notes for abortability All async action handlers receive signal in the argument. Refer examples/04 abort/src for the usage. Note: The implementation depends on AbortController in the DOM spec. If you are using an environment that doesn't have AbortController (for example IE11), you need a polyfill: 1 2 API useReducerAsync useReducer with async actions Parameters reducer R initialState ReducerState\\ asyncActionHandlers AsyncActionHandlers\\ Examples Returns \\[ReducerState\\ , Dispatch\\ ] Examples The examples folder contains working examples. You can run one of them with and open in your web browser. You can also try them in codesandbox.io: 01 02 03 04 Blogs How to Handle Async Actions for Global State With React Hooks and Context","default_branch":null,"files":null,"tree":[],"storefront":"/r/dai-shi","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/dai-shi/use-reducer-async/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}