diff --git a/src/components/List.tsx b/src/components/List.tsx index 84b8d1d..b1824d7 100644 --- a/src/components/List.tsx +++ b/src/components/List.tsx @@ -6,12 +6,11 @@ const List: React.FC = () => { const [data, setData] = useState([]); const [filterText, setFilterText] = useState(""); - const handleChange = async (event: any) => { try { - setFilterText(event.target.value); - - const response = await fetch(`https://api.disneyapi.dev/character?name=${filterText}`); + const value = event.target.value; + setFilterText(value); + const response = await fetch(`https://api.disneyapi.dev/character?name=${value}`); if (!response.ok) { throw new Error(`Error HTTP: ${response.status}`); } @@ -60,4 +59,4 @@ const List: React.FC = () => { ); }; -export default List; \ No newline at end of file +export default List;