File tree 12 files changed +1442
-37
lines changed
12 files changed +1442
-37
lines changed Original file line number Diff line number Diff line change
1
+ [[redirects ]]
2
+ from = " /*"
3
+ to = " /index.html"
4
+ status = 200
Original file line number Diff line number Diff line change 10
10
"@types/node" : " ^12.0.0" ,
11
11
"@types/react" : " ^17.0.0" ,
12
12
"@types/react-dom" : " ^17.0.0" ,
13
+ "@types/react-router-dom" : " ^5.1.7" ,
13
14
"react" : " ^17.0.1" ,
14
15
"react-dom" : " ^17.0.1" ,
16
+ "react-router-dom" : " ^5.2.0" ,
15
17
"react-scripts" : " 4.0.3" ,
16
18
"typescript" : " ^4.1.2" ,
17
19
"web-vitals" : " ^1.0.1"
Original file line number Diff line number Diff line change 24
24
work correctly both with client-side routing and a non-root public URL.
25
25
Learn how to configure a non-root public URL by running `npm run build`.
26
26
-->
27
- < title > React App </ title >
27
+ < title > Gbedu Manager </ title >
28
28
</ head >
29
29
< body >
30
30
< noscript > You need to enable JavaScript to run this app.</ noscript >
Original file line number Diff line number Diff line change 1
1
{
2
- "short_name" : " React App " ,
2
+ "short_name" : " Gbedu Manager " ,
3
3
"name" : " Create React App Sample" ,
4
4
"icons" : [
5
5
{
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import { render , screen } from '@testing-library/react' ;
3
+
3
4
import App from './App' ;
4
5
5
6
test ( 'renders learn react link' , ( ) => {
Original file line number Diff line number Diff line change 1
- import React from 'react' ;
2
- import logo from './logo.svg' ;
3
- import './App.css' ;
1
+ import React , { Suspense } from 'react' ;
2
+ import { Route , Switch } from 'react-router-dom' ;
4
3
5
- function App ( ) {
6
- return (
7
- < div className = "App" >
8
- < header className = "App-header" >
9
- < img src = { logo } className = "App-logo" alt = "logo" />
10
- < p >
11
- Edit < code > src/App.tsx</ code > and save to reload.
12
- </ p >
13
- < a
14
- className = "App-link"
15
- href = "https://reactjs.org"
16
- target = "_blank"
17
- rel = "noopener noreferrer"
18
- >
19
- Learn React
20
- </ a >
21
- </ header >
22
- </ div >
23
- ) ;
24
- }
4
+ import Homepage from './pages/Home' ;
5
+ import MyLibrary from './pages/MyLibrary' ;
6
+ import NotFoundPage from './pages/NotFound' ;
7
+
8
+ const App = ( ) => (
9
+ < Suspense fallback = { < div > Loading....</ div > } >
10
+ < Switch >
11
+ < Route exact path = "/" component = { Homepage } />
12
+ < Route exact path = "/my-library" component = { MyLibrary } />
13
+ < Route component = { NotFoundPage } />
14
+ </ Switch >
15
+ </ Suspense >
16
+ ) ;
25
17
26
18
export default App ;
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import ReactDOM from 'react-dom' ;
3
- import './index.css' ;
3
+ import { BrowserRouter as Router } from 'react-router-dom' ;
4
+
4
5
import App from './App' ;
6
+
7
+ import './index.css' ;
8
+
5
9
import reportWebVitals from './reportWebVitals' ;
6
10
7
11
ReactDOM . render (
8
12
< React . StrictMode >
9
- < App />
13
+ < Router >
14
+ < App />
15
+ </ Router >
10
16
</ React . StrictMode > ,
11
17
document . getElementById ( 'root' )
12
18
) ;
Original file line number Diff line number Diff line change
1
+ function App ( ) {
2
+ return < div className = "App" > Homepage</ div > ;
3
+ }
4
+
5
+ export default App ;
Original file line number Diff line number Diff line change
1
+ function MyLibrary ( ) {
2
+ return < div className = "MyLibrary" > My Library</ div > ;
3
+ }
4
+
5
+ export default MyLibrary ;
Original file line number Diff line number Diff line change
1
+ function NotFound ( ) {
2
+ return < div className = "NotFound" > Page Not Found</ div > ;
3
+ }
4
+
5
+ export default NotFound ;
You can’t perform that action at this time.
0 commit comments