Created
February 22, 2021 15:41
-
-
Save eamonnboyle/068d0549f11b8a9e5dffd05ff0975275 to your computer and use it in GitHub Desktop.
Weather App Tutorial - Using Component in App
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 {LocationSearch} from "./LocationSearch"; | |
function App() { | |
const [locations, setLocations] = useState<string[]>([]); | |
const addLocation = (location: string) => setLocations([location, ...locations]); | |
return ( | |
<div className="container"> | |
<h1>Weather App</h1> | |
<LocationSearch onSearch={addLocation}/> | |
<div> | |
<h2>Locations</h2> | |
<table className="table table-hover"> | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment