Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
fetcher-hook
Advanced tools
Asynchronously use fetch for requests within React components.
Asynchronously use fetch for requests within React components.
$ npm i fetcher-hook
Provide your fetch config or api string and handle the response.
import { Fragment } from "react";
import useFetch from "fetcher-hook";
const { pending, data, error, sendRequest, cancelRequest } = useFetch(
"http://fake.com/api/resource"
);
return pending ? (
<Fragment>
<p>Loading...</p>
<button onClick={cancelRequest}>Click here to cancel request.</button>
</Fragment>
) : data ? (
"Data: " + JSON.stringify(data)
) : error ? (
<button onClick={sendRequest}>
Error: {error.toString()}. Click here to try again.
</button>
) : (
<button onClick={sendRequest}>Click here to send request.</button>
);
The hook only accepts one param, which can either be a string or an object. If it's a string, the param is assumed to be the url to fetch from and it's plugged-in directly to the fetch, otherwise, if it's an object, there's a few 'settings' props available to modify the request.
It is assumed that any other prop(s) that's provided is to be used for the actual fetch function.
FAQs
Asynchronously use fetch for requests within React components.
The npm package fetcher-hook receives a total of 0 weekly downloads. As such, fetcher-hook popularity was classified as not popular.
We found that fetcher-hook 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.