Topic: How would you use React router with MDB instead of using href in the navbar?

mrsirnft free asked 2 years ago

Expected behavior

Actual behavior

Resources (screenshots, code snippets etc.) How would you use react router with the MDB navbar instead of just using href?

All examples us something similar to this


Is there a way to incorporate react router so it would be something like this About

Krzysztof Wilk staff answered 2 years ago


You can import a Link component from the react-router-dom library and pass it to the tag property to use it as the tag of the i.e. MDBNavLink one. So it should look like below:

In the imports section: import { Link } from 'react-router-dom';

In the code: <MDBNavLink tag={Link} to='url'>...</MDBNavLink>

Keep coding!

Please insert min. 20 characters.


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



Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: MDB5 3.0.0
  • Device: Laptop
  • Browser: Chrome
  • OS: MAC
  • Provided sample code: No
  • Provided link: No