diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-06-06 23:52:25 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-06-06 23:52:25 -0700 |
commit | cf20c43948b83539a9a049a81796e15509c393b4 (patch) | |
tree | add07433f014145fd9f65fde58eb26d0edd9d212 /modern/src/reactHelper.js | |
parent | b0afb5deea4de4cc5951d4e6fe17d2040546b8b0 (diff) | |
download | trackermap-web-cf20c43948b83539a9a049a81796e15509c393b4.tar.gz trackermap-web-cf20c43948b83539a9a049a81796e15509c393b4.tar.bz2 trackermap-web-cf20c43948b83539a9a049a81796e15509c393b4.zip |
Reuse map component
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; +} |