Catalog npm
PACKAGE EXPLORERView in registry

6pp

npm

[![Version](https://img.shields.io/npm/v/package-name.svg)](https://www.npmjs.com/package/6pp)

Versions collected39
Direct dependencies11From release 1.3.10
Last observed20 Oct, 20:54 UTC

README

Current package documentation

6pp

Version

License

Description

useFetchData is a powerful custom React hook for fetching data from an API. It provides a simple and efficient way to fetch data, handle loading and error states, and cache responses for improved performance.

The hook uses the Fetch API for data fetching and a local cache for storing the fetched data. This reduces the number of network requests and improves the speed and responsiveness of your application.

The useFetchData hook also provides refetch and clearCache functions, giving you full control over when to refetch the data and when to clear the cache. This makes it a flexible and versatile tool for any application that needs to fetch and manage data from an API.

6pp is a versatile library that provides custom hooks and components for handling common functionalities in React applications.

Features

useFetchData

A custom hook for making HTTP requests and handling data fetching.

Usage

import { useFetchData } from '6pp';

const YourComponent = () => {
  const { data, loading, error, refetch, clearCache } = useFetchData<YourDataType>(url, key);

  // Your component logic using the fetched data

  return (
    // Your JSX
  );
};

Parameters

  • url (string): The URL to fetch the data from.
  • key (string): A unique key to identify and cache the fetched data.

Return Values

  • data (YourDataType): The fetched data.
  • loading (boolean): Indicates whether the data is currently being loaded.
  • error (string): An error message if the fetch encounters an error.
  • refetch (function): A function to manually trigger a data refetch.
  • clearCache (function): A function to clear the cached data.

Installation

npm install 6pp

Contributing

We welcome contributions! If you find any issues or have suggestions, please open an issue or submit a pull request.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 39

Collected releases
VersionPublishedDirect dependenciesOpen version
1.3.10Registry latest28 Feb 202511
1.3.928 Nov 202410
1.3.811 Nov 202410
1.3.711 Nov 20249
1.3.611 Nov 20249
1.3.58 Nov 20249
1.3.428 Oct 20249
1.3.328 Oct 20249
1.3.228 Oct 20249
1.3.128 Oct 20249
1.3.028 Oct 20248
1.2.1623 Apr 20248
1.2.1518 Apr 20248
1.1.1524 Feb 20247
1.1.1424 Feb 20247
1.1.1324 Feb 202411
1.1.1224 Feb 202411
1.1.1124 Feb 202411
1.1.108 Feb 202411
1.1.922 Jan 202411

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 20:54 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:0a4b1e01c8615dbfbd73fa5b09c6f919dc824872a5e17644b2d8e21546929d3b