Skip to content

Instantly share code, notes, and snippets.

@vinodchauhan7
Created November 10, 2019 05:00
Show Gist options
  • Save vinodchauhan7/17dd39b125d7ff53601d7973b1f8972b to your computer and use it in GitHub Desktop.
Save vinodchauhan7/17dd39b125d7ff53601d7973b1f8972b to your computer and use it in GitHub Desktop.
React Hooks with Async-Await
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