H
H
hatealleverything2021-03-07 09:15:46
React
hatealleverything, 2021-03-07 09:15:46

Route doesn't work on reload, is it my crooked hands or a React feature?

Good afternoon, the project itself is on React, it is going through Webpack
Let's say I go to localhost, then I poke on the Navbar on the right and go to this page, everything is as intended
60446ea347ba2202246180.png
But after I want to reload this page with the given route localhost/roulette , he can't load it
60446ed311825559085293.png

. Here's how I write all the routes:

// App

        <BrowserRouter>
            <AppRouter/>
        </BrowserRouter>

// App Router

        <Switch>
            {publicRoutes.map(({path, Component, exact}) =>
                <Route key={path} path={path} component={Component} exact={exact}/>
            )}
            <Route component={Page404}/>
        </Switch>

// Public Routes 

export const publicRoutes = [
    {
        path: CASE_ROUTE,
        Component: Case,
        exact: true
    }
]


I most likely know what the catch is, because there is no roulette.html as such at the root, but React probably provided for this, but for some reason I can’t find it in their documentation

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2021-03-07
@hatealleverything

You need to configure Nginx to only return /index.html- 1 , 2 , 3 .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question