Get live sports scores in your React app for the MLB, NBA, and the NFL.
npm install --save react-sports-hooks
import React from 'react'
import { useScores } from 'react-sports-hooks'
const MyComponent = () => {
const { scores } = useScores("mlb")
return (
...
)
}
REQUIRED
sport
("mlb" | "nba" | "nfl" | "ncaam" | "ncaaf")
OPTIONAL:
You can pass in an options object as the second arg when you instantiate useScores
that can take the following options:
updateIntervalSeconds
(number): How often the data is refreshed, default is 30 seconds.
import React from 'react'
import { useScores } from 'react-sports-hooks'
const MyComponent = () => {
const { scores } = useScores("mlb", { updateIntervalSeconds: 3 })
return (
...
)
}
MIT © andrewrjohn