File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -60,3 +60,37 @@ Then, routed like below automatically
6060| /login/sign-up | /src/pages/login/sign-up.js |
6161| /my-info | /src/pages/my-info.js |
6262| /blablabla | /src/pages/404.js |
63+
64+
65+ <br >
66+
67+ ### usage of dynamic path
68+
69+ Also you can use dynamic path like below
70+
71+ ``` jsx
72+ import React from ' react'
73+ import { BrowserRouter , Switch , Route } from ' react-router-dom'
74+ import DynamicRoute from ' react-dynamic-route'
75+ import Report from ' pages/report'
76+
77+ export default function App () {
78+ return (
79+ < BrowserRouter>
80+ < Switch>
81+ < Route path= " /report/:date" render= {props => < Report {... props} / > } / >
82+ < DynamicRoute
83+ page= {path => import (' ./pages' + path).then (module => module .default )}
84+ loading= {< div> Loading..< / div> }
85+ props= {{
86+ someProp1,
87+ someProp2, // `someProp1` and `someProp2` are transfered to `module.dedault` above finally
88+ }}
89+ / >
90+ < / Switch>
91+ < / BrowserRouter>
92+ )
93+ }
94+ ```
95+
96+
You can’t perform that action at this time.
0 commit comments