
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-async-fetch
Advanced tools
비동기 통신 처리 작업을 쉽게 해주는 React Hooks 모듈입니다.
tanstack-query와 유사하지만, 캐싱과 같이 다른 무거운 기능들은 제거하고 비동기 처리 기능에만 집중한 라이브러리입니다.
Using npm:
npm i react-async-fetch
Using yarn:
yarn add react-async-fetch
in ES Module:
import { useFetch, useMutation, useSuspenseFetch } from "react-async-fetch";
in CommonJS:
const { useFetch, useMutation, useSuspenseFetch } = require("react-async-fetch");
서버로부터 데이터를 요청 할 때의 비동기 처리 로직을 쉽게 다룰 수 있게 해주는 React Hook입니다.
const { result, status, isLoading, isError, error, clearResult, refetch } = useFetch(request, {
enabled,
suspense,
errorBoundary,
refetchInterval,
onSuccess,
onError,
});
request: () => Promise<T>
fetch, axios 등을 사용한 통신 요청 함수가 필요합니다.enabled: boolean
trueenabled가 false라면, request는 실행되지 않습니다.suspense: boolean
truesuspense가 true라면, 요청이 pending 상태일 때 가장 가까운 상위 Suspense가 작동합니다.errorBoundary: boolean
trueerrorBoundary가 true라면, 요청이 rejected 상태가 될 때 가장 가까운 상위 Error Boundary가 작동합니다.refetchInterval: number
refetchInterval의 숫자를 설정한다면, 해당 밀리초마다 request를 다시 실행합니다.onSuccess: (result: T) => void | Promise<void>
onError: (error: Error) => void
result: T | null
null 값을 가집니다.status: "success" | "pending" | "error"
success: request가 성공적으로 이루어진 상태입니다.pending: request가 진행중인 상태입니다.error: request 중 에러가 발생한 상태입니다.isLoading: boolean
true 값을 가집니다.isError: boolean
true 값을 가집니다.error: Error
clearResult: () => void
result 값을 null로 설정하는 함수입니다.refetch: () => void
서버의 데이터를 변경 시킬 때의 요청에 대한 비동기 처리 로직을 쉽게 다룰 수 있게 해주는 React Hook입니다.
const {
mutate
result,
status,
isLoading,
isError,
error
} = useMutation(request, {
errorBoundary,
onSuccess,
onError,
})
request: () => Promise<T>
fetch, axios 등을 사용한 통신 요청 함수가 필요합니다.errorBoundary: boolean
trueerrorBoundary가 true라면, 요청이 rejected 상태가 될 때 가장 가까운 상위 Error Boundary가 작동합니다.onSuccess: (result: T) => void | Promise<void>
onError: (error: Error) => void
mutate: () => Promise<T>
result: T | null
null 값을 가집니다.status: "default" | "pending" | "fulfilled" | "error"
default: request가 아직 실행되지 않은 상태입니다.pending: request가 진행중인 상태입니다.fulfilled: request가 성공적으로 이루어진 상태입니다.error: request 중 에러가 발생한 상태입니다.isLoading: boolean
true 값을 가집니다.isError: boolean
true 값을 가집니다.error: Error
서버 통신 비동기 처리를 Suspense와 ErrorBoundary로 쉽게 다룰 수 있게 해주는 React Hook입니다. 비동기 작업에 대한 캐싱을 수행합니다.
suspense:true 옵션을 사용하는 useFetch와 다른 점은, result 타입에 null이 포함되지 않고, 확정적으로 데이터를 가져올 수 있다는 장점이 있습니다.
다만, 요청한 데이터에 대한 캐싱 작업을 수행하기 때문에 requestKey 인자가 필요합니다.
const { result, status, error, invalidateCache } = useSuspenseFetch(requestKey, request);
requestKey: string
request: () => Promise<T>
fetch, axios 등을 사용한 통신 요청 함수가 필요합니다.result: T
useFetch 훅과 달리, 확정적인 result 타입이 반환됩니다.status: "success" | "pending" | "error"
success: request가 성공적으로 이루어진 상태입니다.pending: request가 진행중인 상태입니다.error: request 중 에러가 발생한 상태입니다.error: Error
invalidateCache: () => void
MIT
FAQs
React Hooks for asynchronous processing
The npm package react-async-fetch receives a total of 1 weekly downloads. As such, react-async-fetch popularity was classified as not popular.
We found that react-async-fetch 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.