Skip to content

Instantly share code, notes, and snippets.

@mariocsantos
Created January 10, 2021 17:16
Show Gist options
  • Save mariocsantos/2cfb2cda115acbd6a89d4443eb520cf6 to your computer and use it in GitHub Desktop.
Save mariocsantos/2cfb2cda115acbd6a89d4443eb520cf6 to your computer and use it in GitHub Desktop.
Favorite food search
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