diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 468e4c1..0ba3a2e 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,21 +1,27 @@ +import { lazy, Suspense } from 'react' import { Route, Routes } from 'react-router' import BackendStatus from './components/BackendStatus' import Banner from './components/Banner' import SearchPage from './pages/SearchPage' -import SightingDetailPage from './pages/SightingDetailPage' -import SubmitSightingPage from './pages/SubmitSightingPage' import './App.css' +// Only the landing page is in the first download. The other pages are +// fetched when their route is first visited, including by direct link. +const SightingDetailPage = lazy(() => import('./pages/SightingDetailPage')) +const SubmitSightingPage = lazy(() => import('./pages/SubmitSightingPage')) + function App() { return ( <>
- - } /> - } /> - } /> - + Loading…

}> + + } /> + } /> + } /> + +