summaryrefslogtreecommitdiffhomepage
path: root/gui/src/renderer
diff options
context:
space:
mode:
authorHank <hank@mullvad.net>2022-10-11 19:54:45 +0200
committerHank <hank@mullvad.net>2022-10-11 19:54:45 +0200
commit39343367fde76e40687566ed2a505551fa9719ca (patch)
tree8c32fafecf118251adb05abd74dce922e2f5b5d5 /gui/src/renderer
parent69698a51656d8891526299d427f2f06fe3bc71a4 (diff)
downloadmullvadvpn-39343367fde76e40687566ed2a505551fa9719ca.tar.xz
mullvadvpn-39343367fde76e40687566ed2a505551fa9719ca.zip
Don't use ref
Diffstat (limited to 'gui/src/renderer')
-rw-r--r--gui/src/renderer/components/AppRouter.tsx8
1 files changed, 4 insertions, 4 deletions
diff --git a/gui/src/renderer/components/AppRouter.tsx b/gui/src/renderer/components/AppRouter.tsx
index d08498b933..36e7ea2239 100644
--- a/gui/src/renderer/components/AppRouter.tsx
+++ b/gui/src/renderer/components/AppRouter.tsx
@@ -1,4 +1,4 @@
-import { createRef, useCallback, useEffect, useRef, useState } from 'react';
+import { createRef, useCallback, useEffect, useState } from 'react';
import { Route, Switch } from 'react-router';
import AccountPage from '../containers/AccountPage';
@@ -37,18 +37,18 @@ export default function AppRouter() {
const { setNavigationHistory } = useAppContext();
const focusRef = createRef<IFocusHandle>();
- const unobserveHistory = useRef<() => void>();
+ let unobserveHistory: () => void;
useEffect(() => {
// React throttles updates, so it's impossible to capture the intermediate navigation without
// listening to the history directly.
- unobserveHistory.current = history.listen((location, _, transition) => {
+ unobserveHistory = history.listen((location, _, transition) => {
setNavigationHistory(history.asObject);
setCurrentLocation(location);
setTransition(transition);
});
- return () => unobserveHistory.current?.();
+ return () => unobserveHistory?.();
}, []);
const onNavigation = useCallback(() => {