diff --git a/src/views/List.jsx b/src/views/List.jsx index 738e5e2..14ba1bd 100644 --- a/src/views/List.jsx +++ b/src/views/List.jsx @@ -10,17 +10,13 @@ export function List({ data }) { setFilterVal(''); }; - useEffect(() => { - setFilteredList(data); - }, [data]); - useEffect(() => { setFilteredList( data.filter((item) => item.name.toLowerCase().includes(filterVal.toLowerCase()), ), ); - }, [filterVal]); + }, [filterVal, data]); return ( <> @@ -37,7 +33,7 @@ export function List({ data }) { value={filterVal} onChange={(e) => setFilterVal(e.target.value)} /> - + {filterVal && }