useThrottledValue
生成节流值的 Hook
代码演示
基本用法
throttledValue:
Live Editor
API
type UseThrottledValue = <T>(value: T, wait: number, options?: Options): T
Options
参数 | 说明 | 必选 | 类型 | 默认值 |
---|---|---|---|---|
leading | 指定在延迟开始前调用 | - | boolean | true |
trailing | 指定在延迟结束后调用 | - | boolean | true |
生成节流值的 Hook
throttledValue:
type UseThrottledValue = <T>(value: T, wait: number, options?: Options): T
参数 | 说明 | 必选 | 类型 | 默认值 |
---|---|---|---|---|
leading | 指定在延迟开始前调用 | - | boolean | true |
trailing | 指定在延迟结束后调用 | - | boolean | true |