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.
@hpe/react-hooks
Advanced tools
A set of reusable React hooks to use in your React >= v16.8.0 projects.
A set of hooks for fetching asynconchronus data. Uses isomorphic-fetch
to allow for server-side rendering. Here's how to use this hook in your React project.
npm install -D @hpe/react-hooks
or yarn add @hpe/react-hooks
import { useFetcher } from '@hpe/react-hooks';
const [data, loading, error] = useFetcher('https://myapi/data');
. When data
is available it will return a json parsed object, loading
returns a boolean to allow a loading state while error
will provide any request errors the hook encountered.useFetcher
accepts a second parameter to accomplish more customized requests, the second parameter behaves exactly a standard fetch
call. More information can be found in the fetch spec.
Below is an example React component using the useFetcher
hook.
import React from 'react';
import { useFetcher } from '@hpe/react-hooks';
function App() {
const [data, loading, error] = useFetcher(
'https://api.openweathermap.org/data/2.5/weather?zip=27278&appid=18ef348ece45174572c5e3d4be8a8d69&units=imperial',
);
return (
<div>
{loading && <div>Loading...</div>}
{error && (
<div>
This error happened:{' '}
<span style={{ background: '#d14545', padding: '2px 5px' }}>
{error.toString()}
</span>
</div>
)}
{data && (
<div>
{data.name} is {data.main.temp} degrees.
</div>
)}
</div>
);
}
export default App;
FAQs
Reusable react hooks.
We found that @hpe/react-hooks demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers 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.