score:0

function AppRoute({...params}) {
    return (
    <>
        <AnyComponentLikeNavBar />
        <Route {...params} />
    </>
    );
}

function App() {
    return (
    <BrowserRouter>
        <Switch>
            <AppRoute path="/" exact component={Main} />
            <AppRoute path="/contact" exact component={Contact} />
            <AppRoute path="/about" exact component={About} />
            <AppRoute path="/blog" exact component={Blog} />

            <Route path='/404' component={Page404} />
            <Redirect from='*' to='/404' />
        </Switch>
    </BrowserRouter>
    );
}

Related Query

More Query from same tag