Modern.js defaults to the convention-based routing based on React Router 6. For more details, please refer to Routing.
In a web application, if there are multiple routes, we may need to authorize access to some of them before accessing them. For example, in the following scenario:
/
route does not require authorization and can be accessed directly./protected
route requires authorization. If there is no authorization, it will automatically redirect to the /login
route. After successful login, it returns to /protected
.