Tatiana
Tatiana

Reputation: 746

Why getting 404 when try to get page via react-router-dom?

I get 404 when try to get by url /items/best. Why it could happens? I use react-router-dom

 <Router history={history}>
                    <Switch>
                        <Route exact path="/items" component={Items} />
                        <Route exact path="/items/best" component={BestItems} />
                        <Route exact path="/login" component={Login} />
                        <Redirect from="*" to="/login" />
                    </Switch>
  </Router>

Upvotes: 0

Views: 66

Answers (1)

Tatiana
Tatiana

Reputation: 746

Finally adding follow setting in webpack config helped me:

output: {
    publicPath: "/",
},

Upvotes: 1

Related Questions