axios-hook
Custom React Hooks for Axios.js. This is a fork of @use-hooks/axios made for internal use by CTS Trade IT a.s.
Install
npm
npm install --save axios-hook
API
Params
/** * Params * @param * @param * @param {('GET'|'POST'|'PUT'|'DELETE'|'HEAD'|'OPTIONS'|'PATCH')} method - The request method * @param * @param * @param * @param */
Returns
/** * Returns * @param * @param * @param * @param */
Usage
; ; { const gender setGender = ; const response loading error reFetch = ; const data = response || {}; const options = gender: 'female' title: 'Female' gender: 'male' title: 'Male' gender: 'unknown' title: 'Unknown' ; if loading return 'loading...'; return <div> <h2> DEMO of <span style= color: '#F44336' >@use-hooks/axios</span> </h2> options <button type="button" onClick=reFetch> Refresh </button> <div> error ? errormessage || 'error' : <textarea cols="100" rows="30" defaultValue=JSON /> </div> </div> ;}
Development
Node >= v8 LTS
- Clone the project to local disk
npm install
npm start
License
MIT
Generated by create-react-hooks.