
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
react-api-fetch-component
Advanced tools
A react component to fetch data from your favorite API.
npm i --save react-api-fetch-component
Don't forget to see the example folder, it contains a complete example of this component, with user registration / login / logout example.
First, include the provider at the root of your app:
import {FetchProvider} from "react-api-fetch-component";
<FetchProvider
baseUrl={'https://example.fr/api'}
baseMode={"cors"}
beforeRequest={(request) => {
// Set the user auth token before each request for example
}}
onError={(error, request) => {
// Common onError, call everytime an error append. Usefull for the refresh token.
}
>
{...children}
</FetchProvider>
Now, you can use the Fetch component where you want to make request:
import {Fetch} from "react-api-fetch-component";
<Fetch url={'/api/endpoint'} method={'GET'}>
{({loading, error, data}) => {
return (
<div>{data.id}</div>
);
}}
</Fetch>
You can see more example in the corresponding folder.
This project is open to contributions :)
FAQs
A react fetch component. Usefull for consuming API.
We found that react-api-fetch-component demonstrated a not healthy version release cadence and project activity because the last version was released 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.