File tree 2 files changed +43
-22
lines changed
fragments/remix/app/routes
2 files changed +43
-22
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ export default function Index() {
66
66
color : "#fff" ,
67
67
} }
68
68
>
69
- Go to /remix-page 👉
69
+ 👈 Go to /remix-page
70
70
</ Link >
71
71
</ div >
72
72
< p > Current Route: /remix-page/details</ p >
Original file line number Diff line number Diff line change @@ -2,17 +2,11 @@ import { useState } from "react";
2
2
import reactLogo from "../assets/react.svg" ;
3
3
import remixLogo from "../assets/remix.svg" ;
4
4
import "../App.css" ;
5
- import { useNavigate } from "react-router-dom" ;
5
+ import { Link , Route , Routes } from "react-router-dom" ;
6
6
7
7
function App ( ) {
8
8
const [ count , setCount ] = useState ( 0 ) ;
9
9
const [ showHost , setShowHost ] = useState ( false ) ;
10
- const navigate = useNavigate ( ) ;
11
-
12
- const goToDetails = ( ) => {
13
- navigate ( "/remix-page/details" ) ;
14
- } ;
15
-
16
10
const toggleShowHost = ( ) => {
17
11
setShowHost ( ! showHost ) ;
18
12
} ;
@@ -28,20 +22,47 @@ function App() {
28
22
</ a >
29
23
</ div >
30
24
< h1 > React + Remix</ h1 >
31
- < button
32
- onClick = { goToDetails }
33
- style = { {
34
- display : "block" ,
35
- padding : "0.5rem" ,
36
- margin : "1rem auto" ,
37
- backgroundColor : "#333" ,
38
- borderRadius : "5px" ,
39
- fontSize : "1rem" ,
40
- color : "#fff" ,
41
- } }
42
- >
43
- Go to /remix-page/details 👉
44
- </ button >
25
+ < Routes >
26
+ < Route
27
+ index
28
+ element = {
29
+ < Link
30
+ to = "/remix-page/details"
31
+ style = { {
32
+ display : "inline-block" ,
33
+ padding : "0.5rem" ,
34
+ margin : "1rem auto" ,
35
+ backgroundColor : "#333" ,
36
+ borderRadius : "5px" ,
37
+ fontSize : "1rem" ,
38
+ color : "#fff" ,
39
+ } }
40
+ >
41
+ Go to /remix-page/details 👉
42
+ </ Link >
43
+ }
44
+ />
45
+ < Route
46
+ path = "/details"
47
+ element = {
48
+ < Link
49
+ to = "/remix-page"
50
+ style = { {
51
+ display : "inline-block" ,
52
+ padding : "0.5rem" ,
53
+ margin : "1rem auto" ,
54
+ backgroundColor : "#333" ,
55
+ borderRadius : "5px" ,
56
+ fontSize : "1rem" ,
57
+ color : "#fff" ,
58
+ } }
59
+ >
60
+ 👈 Go to /remix-page
61
+ </ Link >
62
+ }
63
+ />
64
+ </ Routes >
65
+
45
66
< p
46
67
style = { {
47
68
fontSize : "1rem" ,
You can’t perform that action at this time.
0 commit comments