fetcher-safe
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

fetcher-safe

A custom React hook for handling data fetching with status management.

Installation

You can install this package via npm using the following command:

npm install fetcher-safe

## Usage
Here's how you can use the useFetcher hook in your React component:

import { useFetcher } from 'fetcher-safe';

function MyComponent() {
  const { fetchStatus, data, getUser } = useFetcher();

  // Use the getUser function and access fetchStatus and data as needed

  return (
    <div>
      {/* Your component using fetchStatus and data */}
    </div>
  );
}

## Features


Efficiently handles data fetching with status tracking.
Supports cancellation of fetch requests.

## API

# useFetcher

The useFetcher hook returns an object with the following properties and methods:

fetchStatus: The current status of the data fetching process.
data: The fetched data.
getUser(ENDPOINT: string, API_URL: string): A function to initiate the data fetching process.



## Configuration

No specific configuration is required. However, ensure you have React and its dependencies installed in your project.




© coreasofts

Package Sidebar

Install

npm i fetcher-safe

Weekly Downloads

2

Version

0.1.2

License

ISC

Unpacked Size

9.51 kB

Total Files

9

Last publish

Collaborators

  • hesneysham