import { useState } from "react" ; export default function useDisabled ( timeout ) { const [ is_disabled , setIsDisabled ] = useState ( false ) ; return { disable : ( ) => { setIsDisabled ( true ) ; setTimeout ( ( ) => { setIsDisabled ( false ) ; } , timeout ) ; } , is_disabled } ; }