Frontendx
Frontendx
README.md
SOLUTION.md
main.tsxentry
App.tsx
App.css
index.html
vite.config.ts
Plugins
Installed
react@^19.2.0
react-dom@^19.2.0
Editor
useDebounce Hook
Description
Implement useDebounce(value, delay) and use it in a small demo. The hook returns the latest value only after the input has stopped changing for the specified delay in milliseconds.
The demo must show a text input bound to state, the raw value, and a visible debounced value. Include a hint that rapid typing is collapsed into one update.
Examples
Example 1
Type "react" quickly, then wait 300 ms. The raw value changes on every keystroke, while the debounced value changes once to "react".
Constraints
- Use a React hook and clear the previous timer when the value or delay changes.
- The demo must work without a network request.
- The raw and debounced values must be visibly distinct.
Keep the current value in state and reset a timer whenever it changes.
Preview
Terminal
Test Results
useDebounce Hook
Implement a useDebounce hook and a demo that shows the debounced value after a delay.