Created
November 10, 2019 05:00
-
-
Save vinodchauhan7/17dd39b125d7ff53601d7973b1f8972b to your computer and use it in GitHub Desktop.
React Hooks with Async-Await
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function App() { | |
const [search, setSearch] = React.useState(""); | |
const [query, setQuery] = React.useState(""); | |
return ( | |
<div className="App"> | |
<h1>Search for Books on any Topic</h1> | |
<form | |
onSubmit={e => { | |
e.preventDefault(); | |
setQuery(search); | |
}} | |
> | |
<label>Search : </label> | |
<input type="text" onChange={e => setSearch(e.target.value)} /> | |
<input type="submit" value="search" /> | |
</form> | |
<h1>List Result on {query}</h1> | |
</div> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment