Skip to content

Instantly share code, notes, and snippets.

@eamonnboyle
Created February 22, 2021 15:41
Show Gist options
  • Save eamonnboyle/068d0549f11b8a9e5dffd05ff0975275 to your computer and use it in GitHub Desktop.
Save eamonnboyle/068d0549f11b8a9e5dffd05ff0975275 to your computer and use it in GitHub Desktop.
Weather App Tutorial - Using Component in App
...
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