New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

axios-react-hook

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-react-hook

A lightweight React hook for Axios-based API calls with support for all HTTP methods.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

axios-react-hook

A simple and customizable React hook for making HTTP requests using Axios.

Features

  • ✅ Supports GET, POST, PUT, DELETE, PATCH, etc.
  • ✅ Auto and manual fetching
  • ✅ Refetch support
  • ✅ Pass your own Axios instance

Installation

npm install axios-react-hook

Usage

import useAxios from 'axios-react-hook';
import axiosInstance from './axiosInstance'; // Optional custom instance

const { data, loading, error, refetch } = useAxios(
  'https://jsonplaceholder.typicode.com/posts',
  'get',
  null,
  true,
  axiosInstance
);

API

Parameters

ParamTypeDefaultDescription
urlstringRequest URL
methodstring'get'HTTP method
dataobjectnullRequest payload or query params
autobooleantrueAuto execute request on mount
instanceAxiosInstanceaxiosCustom Axios instance (optional)

License

MIT

Keywords

axios

FAQs

Package last updated on 15 Jun 2025

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