
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
@etheryte/react-hooks
Advanced tools
Common React hooks for worry-free state and control flow management.
@etheryte/react-hooks
Common React hooks for worry-free state and control flow management.
yarn add @etheryte/react-hooks
useUpdateEffect(effect, dependencies?)
Use effect on every update except the initial render. Accepts the same parameters as React.useEffect()
.
useAsyncEffect(asyncEffect, dependencies?)
React.useEffect()
with async helpers. The effect is passed a function isStale()
which returns a boolean value indicating whether the dependencies have changed between the start of the async effect and the moment you call it.
useAsyncEffect(async (isStale) => {
const result = await longAsyncRequest();
// If the dependencies changed between the request start and now, discard the result
if (isStale()) {
return;
}
setFoo(result);
}, dependencies);
useAsyncUpdateEffect(asyncEffect, dependencies?)
Use async effect on every update except the initial render. Accepts the same parameters as useAsyncEffect()
. The effect is passed a function isStale()
which returns a boolean value indicating whether the dependencies have changed between the start of the async effect and the moment you call it.
useAsyncState(getter, dependencies?)
A state variable like React.useState()
that fetches its value from an async source whenever the dependencies change. Stale values are handled automatically.
const value = useAsyncState(async () => {
if (condition) {
return undefined;
}
return longAsyncRequest();
}, dependencies);
FAQs
Common React hooks for worry-free state and control flow management.
The npm package @etheryte/react-hooks receives a total of 0 weekly downloads. As such, @etheryte/react-hooks popularity was classified as not popular.
We found that @etheryte/react-hooks demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.