import { useReducer } from 'react'; import { nextState } from '../util/StateHelper'; const initialState = { table: null, // Network isPollingTable: false }; function reducer(state, action) { switch (action.type) { case 'next': return nextState(state, action); default: throw Error('LeaderboardReducer: unknown action.type', action.type); } } export default function useLeaderboardReducer() { return useReducer(reducer, initialState); }