diff --git a/landing/landing.react.js b/landing/landing.react.js
index 2e0c3ba5c..9b0fbf69f 100644
--- a/landing/landing.react.js
+++ b/landing/landing.react.js
@@ -1,61 +1,58 @@
// @flow
import * as React from 'react';
-import { useLocation, useRouteMatch } from 'react-router-dom';
+import { useRouteMatch } from 'react-router-dom';
import AppLanding from './app-landing.react';
import Footer from './footer.react';
import Header from './header.react';
import Keyservers from './keyservers.react';
import Privacy from './privacy.react';
import Support from './support.react';
import Terms from './terms.react';
+import useScrollToTopOnNavigate from './use-scroll-to-top-on-navigate.react';
export type LandingPageName =
| 'app'
| 'keyservers'
| 'privacy'
| 'terms'
| 'support';
type ActivePage = { name: LandingPageName, node: React.Node };
function Landing(): React.Node {
- const { pathname } = useLocation();
- React.useEffect(() => {
- window?.scrollTo(0, 0);
- }, [pathname]);
-
+ useScrollToTopOnNavigate();
const onPrivacy = useRouteMatch({ path: '/privacy' });
const onTerms = useRouteMatch({ path: '/terms' });
const onSupport = useRouteMatch({ path: '/support' });
const onKeyservers = useRouteMatch({ path: '/keyservers' });
const isLegalPage: boolean = React.useMemo(
() => !!(onPrivacy || onTerms || onSupport),
[onPrivacy, onSupport, onTerms],
);
const activePage: ActivePage = React.useMemo(() => {
if (onPrivacy) {
return { name: 'privacy', node: