doc: add mapCountries useStates hook
This commit is contained in:
1 parent
c1b85ea366
commit
b98b23bbbd
1 file changed
+3
-1
+3
-1
@@ -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() {
|
||||
/>
|
||||
</section>
|
||||
|
||||
<Map center={mapCenter} zoom={mapZoom} />
|
||||
<Map center={mapCenter} zoom={mapZoom} countries={mapCountries} />
|
||||
</article>
|
||||
<Card className="app__right">
|
||||
<CardContent>
|
||||
|
||||
Reference in new issue
Block a user