Home / Learn React / Project 5: Search with Debounce and Loading States

Project 5: Search with Debounce and Loading States

A live search box that waits for you to stop typing, shows loading and empty states, and ignores old responses. Pretend API in this demo.

In shortDebounce the typed value, fetch when it changes, and cancel old requests in the effect cleanup.
Debounced searchTry it Yourself

The request only fires 400 ms after you stop typing. Typing again cancels the previous one.

Quick quiz

1. What does debouncing do?