Skip to content

After adding createBrowserHistory, the app is not working as expected #2108

@tianhao-au

Description

@tianhao-au

I used the version 1-rc for react router. My route config is something like below:

   return (
      <Router>
        <Route path="/" component={App}>
          <IndexRoute component={About} />
          <Route path="about" component={About} />
          <Route path="user" component={User} />
        </Route>
      </Router>
    );

And the access url is like below:
http://localhost:3001/assets# (entry point)
http://localhost:3001/assets#/about?_k=3mr0ay

However, when I added the createBrowserHistory support to the Route:

history={createBrowserHistory()}

The app is not working correctly.

The error is: Warning: Location "/assets" did not match any routes

Even I add the /assets to the path it is still not working.

What's the correct way of doing this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions