0

I have problem with react router.

This is my Router:

    <Router>
    <div>
      <Route exact path="/dashboard" component={projetList} />
      <Route path="/dashboard/:id" component={ 
        (props) => <Editor documentID={props.match.params.id} />
      } />
    </div>
    </Router>

And Link to:

  <Link to="/dashboard">
    <button type="button" class="btn btn-outline-success">
  </Link>

Problem description:

When I click my element - browser try to go to the http://localhost:3000/dashboard but the site is blank.

When I refresh my site (F5 button) then my component load.

KeyB0rys
  • 254
  • 1
  • 9
  • 1
    Are there any errors in your logs when you click on the element? Like in the chrome tools? – Michael Platt Apr 26 '19 at 17:13
  • 1
    Check this similar question asked : https://stackoverflow.com/questions/44356360/react-router-work-on-reload-but-not-when-clicking-on-a-link. This might help you –  Apr 26 '19 at 17:18

1 Answers1

1

Also check out this link: Routes are not navigating when React v15.5 setup with react-redux v5 is. And make sure you put the in the right place. Check this for example :

<browserRouter>

https://pastebin.com/M9hU4Bg4