Chap05 -> Declaring routes -> Creating a component containing routes
This commit is contained in:
parent
7c3215867f
commit
fbc2541230
@ -2,29 +2,33 @@
|
|||||||
import { css } from '@emotion/react';
|
import { css } from '@emotion/react';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Header } from './Header';
|
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
||||||
|
|
||||||
import { HomePage } from './HomePage';
|
import { HomePage } from './HomePage';
|
||||||
import { fontFamily, fontSize, gray2 } from './Styles';
|
import { fontFamily, fontSize, gray2 } from './Styles';
|
||||||
|
import { AskPage } from './AskPage';
|
||||||
|
import { SearchPage } from './SearchPage';
|
||||||
|
import { SignInPage } from './SignInPage';
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
<div
|
<BrowserRouter>
|
||||||
css={css`
|
<div
|
||||||
font-family: ${fontFamily};
|
css={css`
|
||||||
font-size: ${fontSize};
|
font-family: ${fontFamily};
|
||||||
color: ${gray2};
|
font-size: ${fontSize};
|
||||||
`}
|
color: ${gray2};
|
||||||
>
|
`}
|
||||||
<Header />
|
>
|
||||||
<HomePage />
|
<Routes>
|
||||||
</div>
|
<Route path="" element={<HomePage />} />
|
||||||
|
<Route path="search" element={<SearchPage />} />
|
||||||
|
<Route path="ask" element={<AskPage />} />
|
||||||
|
<Route path="signin" element={<SignInPage />} />
|
||||||
|
</Routes>
|
||||||
|
</div>
|
||||||
|
</BrowserRouter>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ProblemComponent extends React.Component {
|
|
||||||
render() {
|
|
||||||
return <div ref="div" />;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default App;
|
export default App;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user