@@ -92,16 +92,21 @@ This will allow ReactPy to handle the transition between routes more quickly by
92
92
the cost of a full page load.
93
93
94
94
``` python
95
- from reactpy import component, html, run
96
- from reactpy_router import link, route, simple, use_location
95
+ from reactpy import component, html, run, use_location
96
+ from reactpy_router import link, route, simple
97
97
98
98
@component
99
99
def root ():
100
- location = use_location()
100
+ use_location()
101
101
return simple.router(
102
- route(" /" , html.h1(" Home Page 🏠" )),
102
+ route(
103
+ " /" ,
104
+ html.div(
105
+ html.h1(" Home Page 🏠" ),
106
+ link(html.button(" About" ), to = " /about" ),
107
+ ),
108
+ ),
103
109
route(" /about" , html.h1(" About Page 📖" )),
104
- link(" /about" , html.button(" About" )),
105
110
)
106
111
```
107
112
@@ -127,10 +132,16 @@ from reactpy_router import link, route, simple, use_query
127
132
128
133
@component
129
134
def root ():
135
+ use_location()
130
136
return simple.router(
131
- route(" /" , html.h1(" Home Page 🏠" )),
132
- route(" /search" , search()),
133
- link(" Search" , to = " /search?q=reactpy" ),
137
+ route(
138
+ " /" ,
139
+ html.div(
140
+ html.h1(" Home Page 🏠" ),
141
+ link(" Search" , to = " /search?q=reactpy" ),
142
+ ),
143
+ ),
144
+ route(" /about" , html.h1(" About Page 📖" )),
134
145
)
135
146
136
147
@component
@@ -152,9 +163,14 @@ from reactpy_router import link, route, simple, use_params
152
163
@component
153
164
def root ():
154
165
return simple.router(
155
- route(" /" , html.h1(" Home Page 🏠" )),
166
+ route(
167
+ " /" ,
168
+ html.div(
169
+ html.h1(" Home Page 🏠" ),
170
+ link(" User 123" , to = " /user/123" ),
171
+ ),
172
+ ),
156
173
route(" /user/{id: int} " , user()),
157
- link(" User 123" , to = " /user/123" ),
158
174
)
159
175
160
176
@component
0 commit comments