Write a component that implements a custom debounce function and displays the debounced input value.
HardProblem 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;
Input
Hardcoded delay: 500ms
Expected Output
The input value updates only after the user stops typing for 500ms.