use-axios-client:使用钩子在React中发出axios请求

时间:2021-03-10 05:51:41
【文件属性】:
文件名称:use-axios-client:使用钩子在React中发出axios请求
文件大小:430KB
文件格式:ZIP
更新时间:2021-03-10 05:51:41
react typescript axios react-hooks TypeScript 使用钩子在React中发出axios请求。 安装 使用npm: $ npm install use-axios-client 与纱线: $ yarn add use-axios-client 例子 import { useAxios } from 'use-axios-client' ; export default ( ) => { const { data , error , loading } = useAxios ( { url : 'https://example/api' , } ) ; return ( < > { loading && < div> Loading... < / div > } { error && < div> { error . message } < / div > } { da

网友评论