Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andrewrjohn/react-sports-hooks
Get live sports scores in your React app for the MLB, NBA, and the NFL.
https://github.com/andrewrjohn/react-sports-hooks
hooks javascript react react-hooks sports
Last synced: 11 days ago
JSON representation
Get live sports scores in your React app for the MLB, NBA, and the NFL.
- Host: GitHub
- URL: https://github.com/andrewrjohn/react-sports-hooks
- Owner: andrewrjohn
- Created: 2020-09-08T21:23:37.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-01T15:44:44.000Z (over 4 years ago)
- Last Synced: 2025-01-01T08:45:50.999Z (12 days ago)
- Topics: hooks, javascript, react, react-hooks, sports
- Language: TypeScript
- Homepage:
- Size: 226 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# React Sports Hooks
Get live sports scores in your React app for the MLB, NBA, and the NFL.
[![NPM](https://img.shields.io/npm/v/react-sports-hooks.svg)](https://www.npmjs.com/package/react-sports-hooks) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
## Install
```bash
npm install --save react-sports-hooks
```## Usage
```tsx
import React from 'react'import { useScores } from 'react-sports-hooks'
const MyComponent = () => {
const { scores } = useScores("mlb")return (
...
)
}
```## Parameters
**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.
### Example with Options
```tsx
import React from 'react'import { useScores } from 'react-sports-hooks'
const MyComponent = () => {
const { scores } = useScores("mlb", { updateIntervalSeconds: 3 })return (
...
)
}
```## License
MIT © [andrewrjohn](https://github.com/andrewrjohn)