Programming Exercises

Write a component that implements a custom debounce function and displays the debounced input value.

Hard

Problem Statement

Write a component that implements a custom debounce function and displays the debounced input value.

Sample Input

Hardcoded delay: 500ms

Sample Output

The input value updates only after the user stops typing for 500ms.

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
import React, { useState } from "react"; const DebouncedInput = () => { return ( <div> <input type="text" placeholder="Type here..." /> <p>Debounced Value: </p> </div> ); }; export default DebouncedInput;
Log in or sign up to run or submit your code.Log inSign up
Input
Hardcoded delay: 500ms
Expected Output
The input value updates only after the user stops typing for 500ms.