🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

react-axios-query

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-axios-query

Combine the power of react-query and axios

0.0.2
latest
Source
npm
Version published
Maintainers
1
Created
Source

react-axios-query

Combine the power of react-query and axios.

install

yarn add react-axios-query

use

import { useAxios } from 'react-axios-query';

type User = {
  name: string;
  phone: string;
  website: string;
}

const Component = (props) => {
  const { 
    isLoading,
    data: {
      data: user
      status
    },
    error,
    isFetching
  } = useAxios<User>({
      method: 'GET',
      url: '/user/1'
    });
  if(isLoading) {
    return 'Loading...';
  }
  if(error) {
    return `Error: ${$error}`;
  }
  return `Status: ${status}, User: ${user}`;
}

FAQs

Package last updated on 20 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts