Buckets:
| import { useEffect, useRef } from "react"; | |
| // https://overreacted.io/making-setinterval-declarative-with-react-hooks/ | |
| const useInterval = (callback, delay) => { | |
| const savedCallback = useRef(); | |
| useEffect(() => { | |
| savedCallback.current = callback; | |
| }, [callback]); | |
| useEffect(() => { | |
| const handler = (...args) => savedCallback.current(...args); | |
| if (delay !== null) { | |
| const id = setInterval(handler, delay); | |
| return () => clearInterval(id); | |
| } | |
| }, [delay]); | |
| }; | |
| export default useInterval; | |
Xet Storage Details
- Size:
- 523 Bytes
- Xet hash:
- 2612cb985ec1fb3ddbd126a2c38d5ad862b7efb6004c89ad3e1b8715b6eb34ab
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.