From b98b23bbbddec9cb63c610a098c1ad0272d4a51f Mon Sep 17 00:00:00 2001 From: Leon Xu Date: Tue, 3 May 2022 20:55:49 -0700 Subject: [PATCH] doc: add mapCountries useStates hook --- src/App.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/App.js b/src/App.js index 5e29590..2249fe1 100644 --- a/src/App.js +++ b/src/App.js @@ -22,6 +22,7 @@ function App() { const [tableData, setTableData] = useState([]); const [mapCenter, setMapCenter] = useState({ lat: 35, lng: 105 }); const [mapZoom, setMapZoom] = useState(3); + const [mapCountries, setMapCountries] = useState([]); useEffect(() => { fetch("https://disease.sh/v3/covid-19/all") @@ -42,6 +43,7 @@ function App() { })); const sortedData = sortData(data); setTableData(sortedData); + setMapCountries(data); setCountries(countries); }); }; @@ -100,7 +102,7 @@ function App() { /> - +