Next
Generation
Components.
Easily plug in the latest trending components and build stunning websites without stressing over design consistency or animations.
48 components12 templates10 blocks
Installs this month
48.2k+18%
Now Playing

Until I Found You
Stephen Sanchez
Single • 2022
2:054:08
MAY 181524JUN 1
Ship the component library
May 1 – May 20
Wire up the design tokens
May 14 – Jun 1
Publish the changelog
May 28 – Jun 8
JUN 8
useDebounce.ts
1import { useEffect, useState } from "react";
2
3export function useDebounce<T>(value: T, delay = 300) {
4 const [debounced, setDebounced] = useState(value);
5
6 useEffect(() => {
7 const id = setTimeout(() => setDebounced(value), delay);
8 return () => clearTimeout(id);
9 }, [value, delay]);
10
11 return debounced;
12}
Sofia
Thanks for your feedback!