
Execute And Watch Async Function In React
This is a React hook for handling asynchronous tasks, such as backend API calls.
How to use it:
1. Install and import the react-async-watcher.
# Yarn $ yarn add react-async-watcher # NPM $ npm i react-async-watcher
import { useAsyncWatcher } from 'react-async-watcher';
2. Basic usage:
const { execute, reset, status, result, error } = useAsyncWatcher() execute(async () => { // do whatever you want })
Preview:
Download Details:
Author: xralphack
Live Demo: View The Demo
Download Link: Download The Source Code
Official Website: https://github.com/xralphack/react-async-watcher
License: MIT
Credit: Source link