Protected Routes With NavItem and SideNavItem


Topic: Protected Routes With NavItem and SideNavItem

rgrashel asked 6 years ago

Hello,

I am looking to see if there are any examples of using "protected" or "private" routes with MDBNavItem? I see from the bundled navigation pages in the Admin Template that BrowserRouter wraps the MDB NavItem components. Is it possible to take an existing HOC (higher order component) and wrap MDBNavItem with it? There are several pages that I would like to ensure that someone is logged in -- and if they aren't logged in, then redirect them to a login page.


Jakub Mandra staff premium answered 6 years ago

Hi,

We do not have examples with more complex routing than int the Admin Template.

It should be possible to use HOC, but I'm not sure if you would not have to cloneElement to attach your attributes.

Best,

Jakub


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.11.0
  • Device: Desktop
  • Browser: Chrome
  • OS: Linux
  • Provided sample code: No
  • Provided link: No
Tags