Home > Software engineering >  Navlink is nor routing toward component and collapse is not working
Navlink is nor routing toward component and collapse is not working

Time:12-23

So i Have added a navbar in my basic react project, when the screen is sm there appears a collapse i want to click on the collapse to show the navbar but its not working when I click on the button everthing goes away

And also i tried to route the navbar to one of my component but it doesn't work

*Edit navlink-is-nor-routing-toward-component-and-collapse-is-not-working

If for some reason you are actually still on v5 and just mixed in the v6 Routes component, switch back to using the Switch component. Switch was replaced by Routes in v6.

import { ..., Switch, ... } from 'react-router-dom';

<Switch>
  <Route path="/menu" component={Menu}/>
  <Route path="/contact" component={Contact}/>
  <Route path="/about" component={About}/>
  <Route path="/" component={Home}/>
</Switch>
  • Related