Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

useLeaderboard

useLeaderboard(handle, leaderboardReadOptions?): LeaderboardResult

A board as the page shows it: its top, the player’s friends or the rows around the player, of its current period, the one before or one by id, kept as it changes while the component is mounted. The top is a snapshot every reader shares, rebuilt every 2 minutes while anyone looks: builtAt says how old it is. A closed period’s top is its frozen result.

Parameter Type
handle LeaderboardHandle
leaderboardReadOptions LeaderboardReadOptions

LeaderboardResult

const board = useLeaderboard(leaderboards.fastestLap.for(track));
board.rows.map((row) => <li key={row.subject.id}>{row.rank} {row.name}</li>);