useThrottle

A hook that handle the throttle value.

API is consistent with ahooks.

Examples

Basic usage

count: 0

throlledCount: 0

Defaut usageclick the button fast, Look at what happens to second value

API

const throttledValue = useThrottle(
  value: any,
  options?: object
);

Params

PropertyDescriptionTypeDefault
valuevalue that requires throttleany-
optionsConfig the throttle behavior. See the Options section below.Options{}

Options

PropertyDescriptionTypeDefault
waitThe number of milliseconds to delay.number1000
leadingSpecify invoking on the leading edge of the timeout.booleantrue
trailingSpecify invoking on the trailing edge of the timeout.booleantrue

最近更新:7/29/2021, 3:48:51 AM