react-router v4 doesn't trigger routes

I'm trying to use react-router v4 and for some reason when I change the routes using normal links and the Link components, the route doesn't trigger, but if I access directly in the URL bar or just refresh the page, the component from that route renders the component. After inspect, I've saw that the context is updated but the props not. As you can see in the image below: code-situation Started at the '/about' route, clicked the '/projects' Link (the AboutMe component stills inside the Switch, instead of change for the Projects component). The routes are defined like this:

<Switch>
    <Route exact path='/' component={Home}/>
    <Route path='/about' component={AboutMe}/>
    <Route path='/projects' component={Projects}/>
    <Route path='/contact' component={Contact}/>
    <Route component={NotFound} />
 </Switch>

I've already tried using the BrowserRouter, HashRouter and just the Router components and also with/without wrapping the routes in the Switch component (nothing seems to work). I'm already after two days searching in tutorials, in the docs, other stackoverflow questions and in the repo issues, and found nothing so far, so here I'm! :)

I'm using these packages:

  • react v15.5.4
  • react-router-dom v4.1.1

Thanks in advance! \o

javascriptreactjsreact-routerreact-router-dom

Answers

comments powered by Disqus