Problem Statement
How to implement a search filter using state and controlled inputs?
Explanation
Keep the input value in state and filter a list based on it. Controlled inputs keep the displayed value in sync with React state, enabling instant updates and validation.
Code Solution
SolutionRead Only
const [search,setSearch]=useState('');
const filtered=data.filter(i=>i.name.includes(search));Practice Sets
This question appears in the following practice sets: