Back to Mantine

Use Throttled Value

apps/mantine.dev/src/pages/hooks/use-throttled-value.mdx

9.4.0484 B
Original Source

import { UseThrottledValueDemos } from '@docs/demos'; import { Layout } from '@/layout'; import { MDX_DATA } from '@/mdx';

export default Layout(MDX_DATA.useThrottledValue);

Usage

The useThrottledValue hook accepts a value and a wait time in milliseconds. It returns a throttled value that cannot change more than once every wait milliseconds.

<Demo data={UseThrottledValueDemos.usage} />

Definition

tsx
function useThrottledValue<T>(value: T, wait: number): T;