Download spectrum/src/hooks/usePrevious.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 221 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/src/hooks/usePrevious.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/spectrum/src/hooks/usePrevious.js
-
curl -L -o usePrevious.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/src/hooks/usePrevious.js
221 Bytes
| // @flow | |
| import { useRef, useEffect } from 'react'; | |
| function usePrevious<T>(value: T): ?T { | |
| const ref = useRef(); | |
| useEffect(() => { | |
| ref.current = value; | |
| }); | |
| return ref.current; | |
| } | |
| export default usePrevious; | |