← React Intermediate Questions - Set 11 Q109

How can you debounce a function in React?

React Intermediate Questions - Set 11

Example

useEffect(() => {
  const t = setTimeout(() => search(q), 400);
  return () => clearTimeout(t);
}, [q]);

What to notice

← Back to the question list