Skip to content

Instantly share code, notes, and snippets.

@eamonnboyle
Created February 22, 2021 15:27
Show Gist options
  • Save eamonnboyle/4fcfacc6c30a40d39cfa8193b00dca29 to your computer and use it in GitHub Desktop.
Save eamonnboyle/4fcfacc6c30a40d39cfa8193b00dca29 to your computer and use it in GitHub Desktop.
Weather App Tutorial - Breaking out Handlers
const disableSearch = locationSearch.trim() === '';
const addLocation = () => {
setLocations([locationSearch, ...locations]);
setLocationSearch('');
};
return (
...
<button onClick={addLocation} disabled={disableSearch}>Search</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment