title toc order
Route Permission
false
1

Basic route permission control

This example demonstrates some of the basic features of React Router, you will need to implement basic route permission control and have to meet the requirements

Requirement

  • Introduce two type of user, Admin and User, you may need to change

  • Without login, all users can only view and visit <Home> and <About>

  • Addtional, both <Home> and <About> don't embaded in Layout

  • After login, Admin can view and visit all pages except <Protected>

  • User can view and visit all pages except <Dashboard>

Implement

  • Open in StackBlitz

  • Fork project

  • Bring your own code

Criteria

  • Just Fake the API

  • Function works as expect

  • Stylesheet is good, but not the point here

  • Bonus: Refactor code, file or folder