Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
http-react
Advanced tools
Http React is a React hooks library for data fetching. It's built on top of the native Fetch
API.
With one hook call, you get all the information about a request that you can use to build UIs that are consistent and performant:
import useFetch from 'http-react'
// This is the default fetcher.
const fetcher = (url, config) => fetch(url, config)
export default function App() {
const { data, loading, error, responseTime } = useFetch('/api/user-info', {
refresh: '30 sec',
fetcher
})
if (loading) return <p>Loading</p>
if (error) return <p>An error ocurred</p>
return (
<div>
<h2>Welcome, {data.name}</h2>
<small>Profile loaded in {responseTime} miliseconds</small>
</div>
)
}
It also works with Next.js' server functions:
// actions.ts
'use server'
import { actionData } from 'http-react'
export async function getData({ id }: { id: number }) {
return actionData({
foo: 'bar'
})
}
// page.tsx
'use client'
import { useAction } from 'http-react'
import { getData } from '@/actions'
export default function Page() {
// data has static typing inferred from the action result
const { data, isPending, error } = useAction(getData, {
params: {
id: 1 // This will show an error if id is not a number
}
})
return isPending ? (
<p>Loading...</p>
) : error ? (
<p>Something went wrong</p>
) : (
<div>
<h2>Welcome</h2>
<p>{data.foo}</p>
</div>
)
}
It supports many features that are necessary in modern applications, while giving developers full control over the request configuration:
and more!
npm install --save http-react
Or
yarn add http-react
FAQs
React hooks for data fetching
We found that http-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.