andrewrjohn / react-sports-hooks

Get live sports scores in your React app for the MLB, NBA, and the NFL.
3 stars 2 forks source link
hooks javascript react react-hooks sports

React Sports Hooks

Get live sports scores in your React app for the MLB, NBA, and the NFL.

NPM JavaScript Style Guide

Install

npm install --save react-sports-hooks

Usage

import React from 'react'

import { useScores } from 'react-sports-hooks'

const MyComponent = () => {
  const { scores } = useScores("mlb")

    return (
      ...
    )
}

Parameters

REQUIRED

OPTIONAL:

You can pass in an options object as the second arg when you instantiate useScores that can take the following options:

Example with Options

import React from 'react'

import { useScores } from 'react-sports-hooks'

const MyComponent = () => {
  const { scores } = useScores("mlb", { updateIntervalSeconds: 3 })

    return (
      ...
    )
}

License

MIT © andrewrjohn