Package Exports
- use-async-effect
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (use-async-effect) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
use-async-effect
🏃 Asynchronous side effects, without the nonsense
Installation
npm install use-async-effect
or
yarn add use-async-effect
This package includes TypeScript and Flow types.
Examples
Basic mount/unmount
useAsyncEffect(async () => console.log('mount'), () => console.log('unmount'), []);
Omitting destroy
useAsyncEffect(async () => console.log('mount'), []);
Handle effect result in destroy
useAsyncEffect(() => fetch('url'), (result) => console.log(result));