Hooks
useCountdown

useCountdown

Hook for querying when an auction will end.

import { useCountdown } from '@public-assembly/builder-utils'

Usage

import { useCountdown } from '@public-assembly/builder-utils'
 
function App({ endTime }: { endTime: number }) {
  const { countdownString, isEnded } = useCountdown(endTime)
 
  return (
    <>
      <p>Auction ends in: {countdownString}</p>
      <p>Is the auction over?: {isEnded}</p>
    </>
  )
}

Returns

{
  isEnded: boolean
  countdownString: string
}