Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 1003 Bytes

story.mdx

File metadata and controls

35 lines (26 loc) · 1003 Bytes

import { Canvas, Meta, Story } from "@storybook/addon-docs/blocks"; import { Example } from "./example.stories";

useThrottledEffect

Like useEffect, but passed function is throttled.

Example

Reference

export function useThrottledEffect(
  callback: (...args: any[]) => void,
  deps: DependencyList,
  delay: number,
  noTrailing = false
): void;

Arguments

  • callback (...args: any[]) => void - Callback like for useEffect, but without ability to return a cleanup function.
  • deps DependencyList - Dependencies list that will be passed to underlying useEffect and useThrottledCallback.
  • delay number - Throttle delay.
  • noTrailing boolean (default: false) - If noTrailing is true, callback will only execute every delay milliseconds, otherwise, callback will be executed once, after the last call.