diff options
Diffstat (limited to 'modern/src/reactHelper.js')
-rw-r--r-- | modern/src/reactHelper.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/modern/src/reactHelper.js b/modern/src/reactHelper.js new file mode 100644 index 00000000..e8a4135a --- /dev/null +++ b/modern/src/reactHelper.js @@ -0,0 +1,10 @@ + +import { useRef, useEffect } from 'react'; + +export const usePrevious = value => { + const ref = useRef(); + useEffect(() => { + ref.current = value; + }); + return ref.current; +} |