({ children, waitBeforeShow = 500 }: Props)
| 12 | */ |
| 13 | |
| 14 | const Delayed = ({ children, waitBeforeShow = 500 }: Props) => { |
| 15 | const [isShown, setIsShown] = useState(false); |
| 16 | |
| 17 | useEffect(() => { |
| 18 | const timer = setTimeout(() => { |
| 19 | setIsShown(true); |
| 20 | }, waitBeforeShow); |
| 21 | return () => clearTimeout(timer); |
| 22 | }, [waitBeforeShow]); |
| 23 | |
| 24 | return isShown ? children : null; |
| 25 | }; |
| 26 | |
| 27 | export default Delayed; |
nothing calls this directly
no outgoing calls
no test coverage detected