React uses a router a special lib calls react-router. The lib allow from SPA make a multiple pages app
React-router official documentation react-router
There is <Route /> component it has three props component render and children. In everyday life you’re going to use component and render It is used in this way to add an inline function use render and to add component use component
1 2 3 4 5 6 7 8 9 10 11 12 13 |
// do not use an inline function with component <Route path="/my/path" component={MyComponent} /> // to pass same data use render and inline <Route path="/my/path" render={(routeProps) => ( <MyComponent {...routeProps} {...props} /> )} /> |
the end