Skip to Content
Developer HubSDKData HooksuseSports

useSports

The useSports hook is used to fetch sports with pre-match and live games.

ℹ️

Hook represents a logic wrapper over TanStack Query’s useQuery hook. Explore TanStack Query docs  to understand what data the hook returns.

Usage

import { useSports } from '@azuro-org/sdk' const { data, isFetching, error } = useSports(props)

Props

{ filter?: { limit?: number // limit the number of games returned from a query for each sport sportSlug?: string countrySlug?: string leagueSlug?: string sportIds?: Array<string | number> } gameOrderBy?: GameOrderBy // default: GameOrderBy.StartsAt - supports Turnover or StartsAt orderDir?: OrderDirection // order direction: asc, desc isLive?: boolean // if `true`, the hook will retrieve live sports chainId?: ChainId query?: QueryParameter<SportData[]> // useQuery params }
type ChainId = | 100 // Gnosis | 137 // Polygon | 80002 // Polygon Amoy | 88888 // Chiliz | 88882 // Chiliz Spicy | 8453 // Base | 84532 // Base Sepolia

Return Value

UseQueryResult<SportData[]>
import { type UseQueryResult } from '@tanstack/react-query' type SportData = { sportId: string slug: string name: string turnover: string countries: Array<{ slug: string name: string turnover: string leagues: Array<{ slug: string name: string turnover: string games: Array<{ gameId: string slug: string title: string startsAt: number state: GameState sportId: string sportSlug: string sportName: string leagueId: string leagueSlug: string leagueName: string countrySlug: string countryName: string participants: Array<{ image?: string name: string }> }> }> }> }
Last updated on