
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
use-fetch-pro
Advanced tools
A powerful React hook for data fetching with support for caching, retries, and cancellation.
A powerful and lightweight custom React hook for data fetching. It extends the native Fetch API with out-of-the-box support for request cancellation, caching, and retry logic.
loading, data, and error states automatically.refetch function to trigger requests manually.npm install use-fetch-pro
import React from 'react';
import { useFetchPro } from 'use-fetch-pro';
interface Post {
id: number;
title: string;
body: string;
}
const MyComponent = () => {
const { data, loading, error, refetch } = useFetchPro<Post[]>(
'https://jsonplaceholder.typicode.com/posts',
{
cache: true, // Enable caching
retry: 3, // Retry up to 3 times on failure
retryDelay: 1000, // Wait 1 second between retries
}
);
if (loading) return <p>Loading...</p>;
if (error) return <p>Error: {error.message}</p>;
return (
<div>
<button onClick={refetch}>Refetch Posts</button>
<ul>
{data?.map(post => (
<li key={post.id}>{post.title}</li>
))}
</ul>
</div>
);
};
export default MyComponent;
useFetchPro<T>(url, options)url (string): The URL to fetch data from.options (object, optional): Configuration for the fetch request.| Option | Type | Default | Description |
|---|---|---|---|
method | string | 'GET' | HTTP request method. |
headers | object | undefined | Request headers. |
body | BodyInit | undefined | Request body. |
retry | number | 0 | Number of times to retry on failure. |
retryDelay | number | 1000 | Delay in milliseconds between retries. |
cache | boolean | false | If true, caches the response in memory. |
cacheTime | number | 300000 | Cache duration in milliseconds (5 minutes). |
An object containing:
| Property | Type | Description |
|---|---|---|
data | T | null | The fetched data, or null if not yet fetched. |
error | Error | null | An error object if the request fails, else null. |
loading | boolean | true while the request is in progress. |
refetch | () => void | A function to manually trigger the fetch request. |
ISC
FAQs
A powerful React hook for data fetching with support for caching, retries, and cancellation.
We found that use-fetch-pro demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.