react-async-watcher
React hook to execute and watch async function.
This package is made for handle asynchronous tasks, such as backend api calls.
- execute async function whenever and whatever you want
- provide execution status and result
- typescript support
- super tiny
Quick Start
Usage
Inside your React or React-Native project directory, run the following command:
yarn add react-async-watcher
or with npm
npm install react-async-watcher
API
useAsyncWatcher
You can pass type to useAsyncWatcher, eq: useAsyncWatcher<number>
(), then type of result will be number | undefined
execute
reset
use it to clear status, result, error