Catalog npm
Back to packageRELEASE DETAILS

1.3.3

npm

6pp

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

Published28 Oct 2024
Direct dependencies9
Transitive dependenciesNot calculated

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.

Declared dependencies 10

Native requirements
9 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
react
Environment
{
  "local_name": "react",
  "alias": false,
  "peer_metadata": null
}
^18.2.0development
tslib
Environment
{
  "local_name": "tslib",
  "alias": false,
  "peer_metadata": null
}
^2.6.2development
rollup
Environment
{
  "local_name": "rollup",
  "alias": false,
  "peer_metadata": null
}
^4.12.0development
react-dom
Environment
{
  "local_name": "react-dom",
  "alias": false,
  "peer_metadata": null
}
^18.2.0development
@types/react
Environment
{
  "local_name": "@types/react",
  "alias": false,
  "peer_metadata": null
}
^18.2.48development
@rollup/plugin-babel
Environment
{
  "local_name": "@rollup/plugin-babel",
  "alias": false,
  "peer_metadata": null
}
^6.0.4development
@rollup/plugin-terser
Environment
{
  "local_name": "@rollup/plugin-terser",
  "alias": false,
  "peer_metadata": null
}
^0.4.4development
rollup-plugin-postcss
Environment
{
  "local_name": "rollup-plugin-postcss",
  "alias": false,
  "peer_metadata": null
}
^4.0.2development
@rollup/plugin-typescript
Environment
{
  "local_name": "@rollup/plugin-typescript",
  "alias": false,
  "peer_metadata": null
}
^11.1.6development
react
Environment
{
  "local_name": "react",
  "alias": false,
  "peer_metadata": null
}
>=18.0.0peer

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "6ba859c3a3fa6c156343c298765ab6d663a7f59b",
  "tarball": "https://registry.npmjs.org/6pp/-/6pp-1.3.3.tgz",
  "fileCount": 24,
  "integrity": "sha512-JgTjHzo8bPq1Q9Hd4EWvevhnOWdklZqcAteQmYId2uhKHYhvUg9AjHl2K9686/Ougz4DTpwFOO7EnJ5EfL3NOg==",
  "signatures": [
    {
      "sig": "MEUCIQCLTOPTB3LoTaac8HLOjdlNZjJmmYQ75nI00EI4hh04pgIgAcTZ7tz6zxnLaCNrhQ2uBiIssiIu94Zq93E2Q1PA8+Y=",
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
    }
  ],
  "unpackedSize": 78946
}

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_version:cfead9f796aeb8cec334a9a56e993d4e206e21cd567d3fbb012e69ffcb3f94f0

Other collected versions

1.3.1028 Feb1.3.928 Nov1.3.811 Nov1.3.711 Nov1.3.611 Nov1.3.58 NovView all collected versions →