useThrottleFn

致谢: Re-export from react-use

React 节流 Hook。

示例

import { useState } from "@lynx-js/react";
import { useThrottleFn } from "@lynx-js/react-use";

const Demo = ({ value }) => {
  const throttledValue = useThrottleFn(value => value, 200, [value]);

  return (
    <view>
      <text>Value: {value}</text>
      <text>Throttled value: {throttledValue}</text>
    <view/>
    </view>
  );
};

类型定义

declare const useThrottle: <T>(value: T, ms?: number) => T;