Skip to content

Commit

Permalink
added search on submit
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamN89 committed Apr 21, 2023
1 parent 54032cd commit 880b40f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,21 @@ export default function Search( { setQuery } ) {
setQuery(inputText)
};

let submitHandler = (e) => {
e.preventDefault();
setQuery(inputText)
}


return (
<div className="Search">
{/* <div className="search_wrapper"> */}
<form className="search_wrapper" onChange={inputHandler}>
<form className="search_wrapper" onSubmit={submitHandler}>
<input
className="search_input"
type="search"
placeholder="Enter your query"
onChange={inputHandler}
/>
<button className="search_button">Search</button>
</form>
Expand Down

0 comments on commit 880b40f

Please sign in to comment.