Avoiding the route clutter in the app.js
file
Most of the times in large applications if the routes are not manages properly the App.js
component (or whatever main component you are using) starts to get cluttered with all sorts of routes and redirects. Over a period of time, you find yourself struggling with managing all these routes.
With RapidAdminReact® you can manage all your base routes in one file. Let’s see how you can manage your routes.
Defining route paths
paths.js
is a single file where you can define all your route paths so that they remian consistent across all components and in case any of the path needs to be changed later, it can be done using this single file. See the directory tree below to know where paths.js
is located.
./config
├── routes
│ ├── paths.js
│ └── routes.js
Sample route definition
routePaths
is a single object that is exported from the paths.js
. See the below code sample to see how you can define various route paths in this object.
const routePaths = {
dashboard : '/' ,
calendar : '/calendar' ,
signIn : '/sign-in' ,
};