diff --git a/src/App.tsx b/src/App.tsx index 61e6cdc..109a21b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -36,7 +36,7 @@ function App() { } else { setLoading(false) } - }, []) + }, [location.search]) const calculatePages = (totalResults: number): number => { return Math.round(totalResults / 10) diff --git a/src/components/MovieForm/index.tsx b/src/components/MovieForm/index.tsx index 1235ff6..ff05ac5 100644 --- a/src/components/MovieForm/index.tsx +++ b/src/components/MovieForm/index.tsx @@ -11,7 +11,10 @@ const MovieForm: React.FC = () => { return ( navigateToPage(movieTitle, movieYear, movieType)} + onSubmit={(e) => { + e.preventDefault() + navigateToPage(movieTitle, movieYear, movieType) + }} > Choose a movie title: { if (type) query += `&type=${type}` if (year) query += `&year=${year}` + console.log(query) + navigate(query) } }