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

na-react-network-manager

v1.0.5

Published

A powerful network request manager for React applications with built-in request queuing, caching, and retry mechanisms.

Readme

NA React Network Manager

A powerful network request manager for React applications with built-in request queuing, caching, and retry mechanisms.

Installation

npm install na-react-network-manager
# or
yarn add na-react-network-manager


## useNetwork React Hook

The `useNetwork` hook simplifies making network requests within your React applications. It handles the complexities of fetching data, managing loading states, and handling errors, allowing you to focus on your application's core logic.

### Function Signature

```typescript
function useNetwork<T = any>(config: RequestConfig): { data: T | null; loading: boolean; error: Error | null }
Parametersconfig: RequestConfigAn object that defines the configuration for the network 
request.interface RequestConfig {
  url: string; // The URL to make the request to.  Required.
  method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'; // The HTTP method to use. Required.
  headers?: Record<string, string>; //  Optional headers to include in the request.
  body?: any;                 //  Optional data to send in the request body (for methods like POST, PUT, etc.).
  cache?: 'default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached'; // Optional caching behavior.
  cacheTime?: number;       // Optional time (in milliseconds) to cache the response.
  retry?: number;           // Optional number of times to retry the request if it fails.
  retryDelay?: number;      // Optional delay (in milliseconds) between retries.
  timeout?: number;         // Optional timeout (in milliseconds) for the request.
}

Return Value
An object containing the following properties:data: T | null: The data returned from the network request. Will be null if the request is still loading or an error occurred. The type T is generic, and you should specify the expected data type when calling useNetwork.loading: boolean: A boolean indicating whether the request is currently in progress. true if loading, false otherwise.error: Error | null: An Error object if the request failed, or null if the request was successful or is still loading.

Usage 
Import the hook:
import { useNetwork } from 'na-react-network-manager'; 

Use the hook in your functional component:import React from 'react';

interface UserData {
  id: number;
  name: string;
  email: string;
}

const MyComponent = () => {
  const { data, loading, error } = useNetwork<UserData>({
    url: 'https://jsonplaceholder.typicode.com/users/1',
    method: 'GET',
  });

  if (loading) {
    return <div>Loading...</div>;
  }

  if (error) {
    return <div>Error: {error.message}</div>;
  }

  if (data) {
    return (
      <div>
        <h1>{data.name}</h1>
        <p>Email: {data.email}</p>
      </div>
    );
  }

  return null; // Or some default/placeholder content
};

export default MyComponent;