score:0

Try this.

function App() {
  return (
    <BrowserRouter>
      <Switch>
        <Route path="/" component={Login} exact />
        <Route path="/dashboard/:nameComponent?"  component={Dashboard}/> 
      </Switch>
    </BrowserRouter>
  );
}

or try to have a default router

<Route path="*" component={Notfound}/>

score:0

I see that you have configured the default route to the login page check what are you doing on the login component page.

and also noticed from the screenshot that the route is dashboards/flanets, but I don't see that URL in the routes.

  1. see if you are adding any code which will hide the component if login is done .?

  2. What are you doing after login redirects some other page .?

  3. if you are redirecting add a route for that page as well

  4. you can add and see if that is showing some**Component.

the empty page may be shown if you don't have a router configured for the route

score:0

App.js


import React from "react";
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";

function App() {
  return (
    <Router>
      <Switch>
        <Route path="/" component={Login} exact />
        <PrivateRoute path="/dashboard" component={Dashboard} />
        <Route path="/dashboard/search" component={Search} />
      </Switch>
    </Router>
  );
}

export default App;

answer

Deleting exact is work


Related Query

More Query from same tag