diff --git a/src/App.js b/src/App.js index b37b487..fd7401f 100644 --- a/src/App.js +++ b/src/App.js @@ -22,6 +22,12 @@ const App = () => { setMovies(data.Search); }; + const handleSearch = (e) => { + if (e.key === "Enter") { + searchMovies(searchTerm); + } + }; + return (
@@ -31,7 +37,9 @@ const App = () => { setSearchTerm(e.target.value)} + onKeyDown={handleSearch} placeholder="Search for movies" + />