Chap05 -> Handling routes not found

Chap05
Jason Zhu 2022-03-29 15:55:55 +11:00
parent fbc2541230
commit 5b79adea19
2 changed files with 6 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import { fontFamily, fontSize, gray2 } from './Styles';
import { AskPage } from './AskPage'; import { AskPage } from './AskPage';
import { SearchPage } from './SearchPage'; import { SearchPage } from './SearchPage';
import { SignInPage } from './SignInPage'; import { SignInPage } from './SignInPage';
import { NotFoundPage } from './NotFoundPage';
function App() { function App() {
return ( return (
@ -25,6 +26,7 @@ function App() {
<Route path="search" element={<SearchPage />} /> <Route path="search" element={<SearchPage />} />
<Route path="ask" element={<AskPage />} /> <Route path="ask" element={<AskPage />} />
<Route path="signin" element={<SignInPage />} /> <Route path="signin" element={<SignInPage />} />
<Route path="*" element={<NotFoundPage />} />
</Routes> </Routes>
</div> </div>
</BrowserRouter> </BrowserRouter>

View File

@ -0,0 +1,4 @@
import React from 'react';
import { Page } from './Page';
export const NotFoundPage = () => <Page title="Page Not Found">{null}</Page>;