usecovid
v1.0.8
Published
React custom hook to get the latest information about Covid19
Downloads
3
Readme
useCovid
React custom hook to get the latest information about Covid19 Extracted from CSSEGISandData daily reports.
Install
npm install --save usecovid
-or-
yarn add usecovid
Data format
[{
"Active": "0",
"Admin2": "Abbeville",
"Combined_Key": "Abbeville",
"Confirmed": "3",
"Country_Region": "US",
"Deaths": "0",
"FIPS": "45001",
"Last_Update": "2020-03-30 22:52:45",
"Lat": "34.22333378",
"Long_": "-82.46170658",
"Province_State": "South Carolina",
"Recovered": "0"
},
...]
Usage
import React from 'react'
import useCovid from "usecovid";
function App() {
const { data, countryData, stateData } = useCovid({
country: "US",
state: "South Carolina",
date: '03-30-2020'
});
return data ? (
<>
<div>Data length: {data.length}</div>
<div>Country length: {countryData && countryData.length}</div>
<div>State length: {stateData && stateData.length}</div>
</>
) : (
<h1>Loading</h1>
);
}
Properties
| Value | Default | Type |
| ------------ | ------------ | ------------ |
| date | new Date()
| string |
| country | null | string |
| state | null |string |
Check the country list: Country list.
History reports from CSSEGISandData: Reports
License
MIT © bbernag
This hook is created using create-react-hook.