Created
February 22, 2021 15:27
-
-
Save eamonnboyle/4fcfacc6c30a40d39cfa8193b00dca29 to your computer and use it in GitHub Desktop.
Weather App Tutorial - Breaking out Handlers
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
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