Skip to content

Commit 72e575a

Browse files
updated
1 parent 381a825 commit 72e575a

File tree

9 files changed

+28
-66
lines changed

9 files changed

+28
-66
lines changed

chapter-6/.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,4 @@ generated-cra-app
2121
.cra-template-rb
2222
template
2323

24-
2524
.eslintcache

chapter-6/package-lock.json

+11-46
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chapter-6/src/app/index.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
import { Container } from '@material-ui/core';
1010
import * as React from 'react';
1111
import { Helmet } from 'react-helmet-async';
12-
import { BrowserRouter } from 'react-router-dom';
13-
import { GlobalStyle } from 'styles/global-styles';
12+
import { Switch, Route, BrowserRouter } from 'react-router-dom';
1413

15-
import NavigationBar from './views/components/navigation-bar';
14+
import { GlobalStyle } from 'styles/global-styles';
15+
import NavigationBar from './components/navigation-bar';
1616
import { Routes } from './routes';
1717

1818
export function App() {

chapter-6/src/app/routes.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,40 @@ export const Routes = () => {
1111
<Suspense fallback={<LinearProgress style={{ margin: '10rem' }} />}>
1212
<Switch>
1313
{/*eager loading*/}
14-
<Route exact path={'/'} component={HomePage} />
14+
<Route path={'/'} component={HomePage} exact />
1515
{/*lazy loadings*/}
1616
<Route
17-
exact
1817
path={'/about'}
1918
component={lazy(() => import('./views/pages/AboutPage'))}
19+
exact
2020
/>
21+
2122
<Route
2223
path={'/dashboard'}
2324
render={({ match: { path } }) => (
2425
<Dashboard>
2526
<Switch>
2627
<Route
27-
exact
2828
path={path + '/'}
2929
component={lazy(
3030
() => import('./views/dashboard/dashboard-default-content'),
3131
)}
32+
exact
3233
/>
3334
<Route
34-
exact
3535
path={path + '/settings-and-privacy'}
3636
component={lazy(
3737
() => import('./views/dashboard/settings-and-privacy'),
3838
)}
39+
exact
3940
/>
40-
<Route exact from={path + '/*'} to={path} />
4141
</Switch>
4242
</Dashboard>
4343
)}
4444
/>
4545
{/*eager loading*/}
46-
<Route path={'/not-found'} component={NotFoundPage} />
47-
<Redirect exact from={'*'} to={'/not-found'} />
46+
<Route path={'/not-found'} component={NotFoundPage} exact />
47+
<Redirect from={'*'} to={'/not-found'} exact />
4848
</Switch>
4949
</Suspense>
5050
);

chapter-6/src/app/views/pages/AboutPage.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react';
33
const AboutPage = () => {
44
return (
55
<div>
6-
<h1>Hello AboutPage</h1>
6+
<h1>This is About Page</h1>
77
</div>
88
);
99
};
+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import React from 'react';
1+
import React, { useState, useEffect } from 'react';
22

3-
const HomePage = () => {
3+
const Main = () => {
44
return (
5-
<div style={{ height: '20rem' }}>
6-
<h1>Hello HomePage</h1>
5+
<div>
6+
<h1>Main Page</h1>
77
</div>
88
);
99
};
1010

11-
export default HomePage;
11+
export default Main;

chapter-6/src/app/views/pages/NotFoundPage.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react';
33
const NotFoundPage = () => {
44
return (
55
<div>
6-
<h1>Not Found Page - 404</h1>
6+
<h1>404 Page Not Found</h1>
77
</div>
88
);
99
};

chapter-6/src/index.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import { configureAppStore } from 'store/configureStore';
2323

2424
// Initialize languages
2525
import './locales/i18n';
26-
import CssBaseline from '@material-ui/core/CssBaseline';
2726

2827
const store = configureAppStore();
2928
const MOUNT_NODE = document.getElementById('root') as HTMLElement;
@@ -35,7 +34,6 @@ const ConnectedApp = ({ Component }: Props) => (
3534
<Provider store={store}>
3635
<HelmetProvider>
3736
<React.StrictMode>
38-
<CssBaseline />
3937
<Component />
4038
</React.StrictMode>
4139
</HelmetProvider>

0 commit comments

Comments
 (0)