Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
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
The npm package http-react receives a total of 177 weekly downloads. As such, http-react popularity was classified as not popular.
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.