import { useEffect, useState } from 'react' import { SiteHeader } from './components/SiteHeader' import { DocsPage } from './pages/DocsPage' import { HomePage } from './pages/HomePage' function App() { const [pathname, setPathname] = useState(() => window.location.pathname.replace(/\/$/, '') || '/') useEffect(() => { const onPopState = () => setPathname(window.location.pathname.replace(/\/$/, '') || '/') window.addEventListener('popstate', onPopState) return () => window.removeEventListener('popstate', onPopState) }, []) const navigate = (nextPath: string) => { const normalized = nextPath.replace(/\/$/, '') || '/' window.history.pushState({}, '', normalized) setPathname(normalized) } const isDocsPage = pathname === '/docs' return (
{isDocsPage ? : }
) } export default App