Build a text input that filters a fixed list of countries as you type and lets you pick a match — the core of every autocomplete, without the network. In React the whole thing is a small piece of derived state: the input owns a query string, and the dropdown is computed from it, not stored separately.
The starter App.tsx renders an empty input over a fixed COUNTRIES array. Make it interactive:
useState('') (query) and an open boolean with useState(false).matches — the countries whose lowercase text includes query.toLowerCase(). Keep it empty when query is blank.matches as <li className="suggestion"> inside a <ul className="suggestions">, but only when open and there is at least one match.ch shows a dropdown with Chile and China; typing chi narrows it, then chin leaves just China.Chile sets the input to Chile and closes the list.results state in sync with query — compute matches during render.String.includes for a simple contains match.open is separate from matches. You need an explicit flag so a click can close the list even though the picked value still matches itself.styles.css; focus on the state.