Click in order · JavaScript and React course · Module 5: useEffect and Custom Hooks
useDebounce Custom Hook Syntax
Arrange the useDebounce custom hook syntax in the correct order:
Items to click
- return debouncedValue;
- return () => clearTimeout(timer);
- }, [value, delay]);
- const [debouncedValue, setDebouncedValue] = useState(value);
- useEffect(() => {
- function useDebounce(value, delay) {
- const timer = setTimeout(() => setDebouncedValue(value), delay);
You can check the correct answer by solving this task in the CodeWorlds game.