Skip to content

Instantly share code, notes, and snippets.

View matheusTA's full-sized avatar
👾
BUG

Matheus Antonino matheusTA

👾
BUG
View GitHub Profile
@matheusTA
matheusTA / use-countdown.ts
Last active March 10, 2024 21:41
useCountdown, it`s a hook to block buttons from being clicked for a certain period of time
import { addMilliseconds, differenceInMilliseconds } from 'date-fns'
import { useEffect, useState } from 'react'
interface RetryItem {
id: string
dateToEnable: Date
}
interface UseCountdownProps {
storageKey: string