My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

How can I protect role based route in react

theromie's photo
theromie
·Jul 29, 2020·

1 min read

I want to setup react project where I have 3 roles like User, Author and etc.. and 3 of them have different UI or dashboard. So when user logged based on role of that user it should redirect to that base route of that role e.g. like /user/home or /author/home or when author tries to hit /user/ routes it should not be accessible.