Routing
Last updated
Was this helpful?
Last updated
Was this helpful?
react-router
is the de-facto standard routing solution for React applications.
There is a detailed explanation for this decision . In short, the recommendation is to forego keeping routes in the Redux store, simply because it shouldn't be needed. There are other ways of navigating, as explained there.
To add a new route, simply import the Route
component and use it standalone or inside the Routes
component (all part of ):
Top level routes are located in src/app/index.tsx
.
If you want your route component (or any component for that matter) to be loaded asynchronously, use the component generator with 'Do you want to load resources asynchronously?' option activated.
For example, if you have a route called about
at /about
, and want to make a child route called team
at /about/our-team
, follow the example in src/app/index.tsx
to create a Routes
within the parent component.
AboutPage/index.tsx
You can use the react-router hooks
, such as or , to change the route, get params, and more.
You can read more in .