V
V
Vladimir2020-06-14 06:41:33
React
Vladimir, 2020-06-14 06:41:33

Why is the route not working for 404 pages?

Good morning. Please tell me what I did wrong?

return (
        <div>

            <Router>

                <Switch>

                    <Route path='/find-company'>

                        <TopBar />

                        <GetCompanySearchPage />

                        <Footer />

                    </Route>

                    <Route path='/company'>

                        <TopBar />

                        <GetCompanyPage company={company} />

                        <Footer />

                    </Route>

                    <Route path='/tenders'>

                        <TopBar />

                        <GetTenders tenders={tenders}/>

                        <Footer />

                    </Route>

                    <Route path='/'>
                        <Header />
                        <GetMain />
                        <Footer />
                    </Route>

                    <Route>
                        <Page404 />
                        <Footer />
                    </Route>

                </Switch>

            </Router>
        </div>
    );


Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2020-06-14
@HistoryART

Understood, here you need to add exact

<Route exact path='/'>
                        <Header />
                        <GetMain />
                        <Footer />
                    </Route>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question