aboutsummaryrefslogtreecommitdiff
path: root/modern/src/reactHelper.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-06-06 23:52:25 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-06-06 23:52:25 -0700
commitcf20c43948b83539a9a049a81796e15509c393b4 (patch)
treeadd07433f014145fd9f65fde58eb26d0edd9d212 /modern/src/reactHelper.js
parentb0afb5deea4de4cc5951d4e6fe17d2040546b8b0 (diff)
downloadtrackermap-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.js10
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;
+}