npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

use-axios-loader

v1.4.6

Published

Tiny React hook that turns axios request activity into a single loading boolean

Readme

use-axios-loader

use-axios-loader attaches axios interceptors, tracks concurrent requests, and gives you a single [loading] value to drive a top bar, spinner, overlay, or skeleton state.

Why

  • Tracks only the requests it started, so ignored requests do not accidentally clear the loader.
  • Works with the default axios export and custom instances created with axios.create().
  • Accepts exact URL strings and RegExp patterns for ignored requests.
  • Cleans up interceptors automatically on unmount.
  • Ships compact CJS and ESM builds with sideEffects: false.

Installation

Install the hook with the common peer packages you already use in a React + axios app.

npm install use-axios-loader react axios
yarn add use-axios-loader react axios
pnpm add use-axios-loader react axios
bun add use-axios-loader react axios

Usage

import axios from 'axios';
import { useAxiosLoader } from 'use-axios-loader';

const api = axios.create({
  baseURL: 'https://api.example.com',
});

export function AppShell() {
  const [loading] = useAxiosLoader(api);

  return (
    <div>
      {loading ? <div className="loader" /> : null}
      <main>...</main>
    </div>
  );
}

Ignoring Requests

Pass a second argument to skip requests that should not affect the global loader.

const ignoredUrls = [
  '/health',
  /\/analytics\/ping$/,
];

const [loading] = useAxiosLoader(api, ignoredUrls);

String values use exact matching. Regular expressions let you ignore URL patterns.

API

const [loading] = useAxiosLoader(axiosInstance, ignoredUrls);
  • axiosInstance: an axios instance, including the default axios export.
  • ignoredUrls: optional array of exact URL strings or RegExp matchers.
  • loading: true while one or more tracked requests are still in flight.

Compatibility

  • React >=16.8
  • CI runs on Node 18.x, 20.x, 22.x, and 24.x
  • Published output includes both CommonJS and ESM entry points
  • No exports gate, so existing top-level and deep package paths keep resolving as before

Development

yarn test
yarn build
npm run size

License

MIT © olivier1208