Created
January 10, 2021 17:16
-
-
Save mariocsantos/2cfb2cda115acbd6a89d4443eb520cf6 to your computer and use it in GitHub Desktop.
Favorite food search
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
import React, { useState } from 'react'; | |
function FavoriteFoodSearch() { | |
const [search, setSearch] = useState(''); | |
const handleChange = (event) => { | |
setSearch(event.target.value ?? ''); | |
} | |
return ( | |
<form> | |
<input type="text" onChange={handleChange}/> | |
<button disabled={!search}>Search</button> | |
</form> | |
); | |
} | |
export { FavoriteFoodSearch }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment