title: How to authorize user based on role in React
body: <p>I am working on the React app currently I have different roles for-example ( admin, manager, agent), etc. I want to protect each route if the user is not authorized for that component/page. If the user is not authorize then I want to redirect the homepage. I want to be done after login. I am a beginner and I want to resolve my problem any example would be appreciated.</p>
  
  <p>Thanks</p>