Using MDBReact Navbar components with Gatsby


Topic: Using MDBReact Navbar components with Gatsby

lakman1 asked 5 years ago

Expected behavior

I would like to use MDBReact components in GatsbyJS, currently I'm worling on the navbar implementation.

Actual behavior

I get stuck when it comes to the navbar implementation, since this element heavily relies on react-router-dom. But this component is not implemented in Gatsby. As far as I know, they are using their own solution for routing.

Resources (screenshots, code snippets etc.)

Error: Invariant failed: You should not use 'NavLink' outside a 'Router'


Jakub Chmura staff premium answered 5 years ago

Hi @lakman1,

Try to replace the MDBNavLink component by a link from gatsby router.

MDBNavLink is a wrapper for react-router-dom link. When you replace it this error should disappear.

Best, Kuba


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.27.0
  • Device: Dekstop
  • Browser: Chrome
  • OS: Win10
  • Provided sample code: No
  • Provided link: Yes