1.0.8 • Published 4 years ago

usecovid v1.0.8

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

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

ValueDefaultType
datenew Date()string
countrynullstring
statenullstring

Check the country list: Country list.

History reports from CSSEGISandData: Reports

License

MIT © bbernag


This hook is created using create-react-hook.

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago