Difficulty: 5/10debounce logic, custom hooks, performance optimizationjavascriptCopyScenario Questions0-2 years experience1Can you walk me through how you'd implement a useDebounce hook that takes a value and a delay and returns the debounced value?2If the component using your hook unmounts before the timeout fires, what cleanup step is required?3What happens to the debounced output if the delay prop changes between renders?2-5 years experience1Follow-up QuestionsWhat could go wrong if you forget to clear the timeout in the cleanup function?How would you write a unit test to verify the debounce timing behavior?If the delay prop changes frequently, how does that affect the hook's behavior?Suggest Improvement