about summary refs log tree commit diff
path: root/src/view/lib/navigation.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/view/lib/navigation.ts')
-rw-r--r--src/view/lib/navigation.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/view/lib/navigation.ts b/src/view/lib/navigation.ts
new file mode 100644
index 000000000..2024918e7
--- /dev/null
+++ b/src/view/lib/navigation.ts
@@ -0,0 +1,12 @@
+import {useEffect} from 'react'
+import {useStores} from '../../state'
+
+type CB = () => void
+/**
+ * This custom effect hook will trigger on every "navigation"
+ * Use this in screens to handle any loading behaviors needed
+ */
+export function useLoadEffect(cb: CB, deps: any[] = []) {
+  const store = useStores()
+  useEffect(cb, [store.nav.tab, ...deps])
+}