Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@react-hook/throttle
Advanced tools
A react hook for throttling values and callbacks.
npm i @react-hook/throttle
yarn add @react-hook/throttle
import {useThrottle, useThrottleCallback} from '@react-hook/throttle'
// throttling a value
const F = props => {
// basic usage
const [value, setValue] = useThrottle(
'initialValue',
30/*fps*/,
true/*leading*/
)
}
// throttling a callback
const CallbackExample = (initialState, fps = 30, leading = false) => {
// this is the exact code that useThrottle() uses
const [state, setState] = useState(initialState)
return [
state,
useThrottleCallback(setState, fps, leading)
]
}
useThrottle(initialValue: any, fps: number, leading: bool)
initialValue
<any>
fps
<number>
setState
is calledleading
<bool>
setState
on the leading edge (right away). When false
setState
will not be called until the next frame is due[value: any, setValue: function]: array
value
setValue
or the initialValue
setValue
setState
callbackuseThrottleCallback(fn: function, fps: number, leading: bool)
fn
<any>
fps
<number>
setState
is calledleading
<bool>
setState
on the leading edge (right away). When false
setState
will not be called until the next frame is duesetValue: function
throttledFn
fn
callbackFAQs
A React hook for throttling setState and other callbacks
The npm package @react-hook/throttle receives a total of 176,582 weekly downloads. As such, @react-hook/throttle popularity was classified as popular.
We found that @react-hook/throttle 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.