delay component
Created
January 6, 2020 10:31
-
-
Save hew/90648bcaac46a8634e3993602229998d to your computer and use it in GitHub Desktop.
Delay Component
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useCallback } from 'react'; | |
import {useTimeout} from 'react-use'; | |
export const Delay = ({ms = 1200, children}) => { | |
const [isReady] = useTimeout(ms); | |
return isReady() ? children : null; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment