@amiright/hooks

[![npm version](https://img.shields.io/npm/v/%40amiright%2Fhooks?style=flat-square)](https://www.npmjs.org/package/%40amiright%2Fhooks) [![install size](https://packagephobia.now.sh/badge?p=%40amiright%2Fhooks)](https://packagephobia.now.sh/result?p=%40am


Keywords
react, hook, axios, promise, es6
License
ISC
Install
npm install @amiright/hooks@0.0.1

Documentation

@amiright/hooks

npm version install size npm downloads

Install with npm

npm install --save @amiright/hooks

useRequest

A React hook used to send request

Usage

import { useRequest } from '@amiright/hooks'

am4core.useTheme(am4themes_animated)

const App = () => {
  /**
   * 
   * @param {Object} config Axios config
   */
  const { loading, status, data, error } = useRequest({ 
    method: 'get',
    url: 'YOU_API_ENDPOINT'
  })
  console.log(loading, status, data, error)
 
  ...
}