Topic: MDB React Navbar not showing up

Kreuzzes free asked 1 year ago


Expected behavior I just pasted the basic examples in my component (code: https://pastebin.com/DTgGgAa7)

Actual behavior Navbar doesnt show up no matter what I'm doing. Examples like the Charts work actually and also the basic Website shows up correctly. I'm using MDBPro if that matters. Also other Navbar examples don't work and changing the useState doesn't update anything or so. Tried to reload and "recompile" multiple times.


Grzegorz Bujański staff answered 1 year ago


it looks like you changed the stat name but didn't update it in the navbar code.

const [showNav, setShowNav] = useState(false);
...
            <MDBNavbarToggler
              aria-controls='navbarSupportedContent'
              aria-expanded='false'
              aria-label='Toggle navigation'
              onClick={() => setShowBasic(!showBasic)}
            >
              <MDBIcon icon='bars' fas />
            </MDBNavbarToggler>

            <MDBCollapse navbar show={showBasic}>
...

The basic example in our documentation is correct, so I assume you used a different example. please send an example from which you copied it, we will fix it.



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

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: MDB5 5.1.0
  • Device: Lenovo ThinkPad L15 AMD Gen.2
  • Browser: Firefox, Brave, Chromium
  • OS: Manjaro Linux
  • Provided sample code: No
  • Provided link: Yes