diff --git a/apps/explorer/src/app/app.tsx b/apps/explorer/src/app/app.tsx index 595caabdc..b4c694d23 100644 --- a/apps/explorer/src/app/app.tsx +++ b/apps/explorer/src/app/app.tsx @@ -1,3 +1,5 @@ +import { useState, useEffect, useMemo } from 'react'; +import { useLocation } from 'react-router'; import { ApolloProvider } from '@apollo/client'; import { ThemeContext } from '@vegaprotocol/react-helpers'; import { useThemeSwitcher } from '@vegaprotocol/react-helpers'; @@ -5,26 +7,37 @@ import { createClient } from './lib/apollo-client'; import { Nav } from './components/nav'; import { Header } from './components/header'; import { Main } from './components/main'; -import React from 'react'; import { DATA_SOURCES } from './config'; import { TendermintWebsocketProvider } from './contexts/websocket/tendermint-websocket-provider'; function App() { const [theme, toggleTheme] = useThemeSwitcher(); + const [menuOpen, setMenuOpen] = useState(false); - const client = React.useMemo( - () => createClient(DATA_SOURCES.dataNodeUrl), - [] - ); + const location = useLocation(); + + useEffect(() => { + setMenuOpen(false); + }, [location]); + + const client = useMemo(() => createClient(DATA_SOURCES.dataNodeUrl), []); return ( -
-
-