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.
see if you are adding any code which will hide the component if login is done .?
What are you doing after login redirects some other page .?
if you are redirecting add a route for that page as well
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
Source: stackoverflow.com
Related Query
- Seeing Blank page After refresh in nested routes in React Router
- React Router - Stay at the same page after refresh
- React Router Dom Redirect needs to refresh the page to work
- React Router - Preserve current route after page refresh
- ReactJS: Go to anchor link in HTML with react router dom only after the full page load
- React Router shows blank page until refresh
- Using React router V6 and when refresh page I get blank page
- React Router Dom Issue - localhost:3000/products to localhost:3000/products/2 is working fine but when I refresh page then I get some error in console
- Blank page on login/logout with history.push in React Router Dom
- Netlify blank page when refresh url with more than one path param using react router
- React Router Dom Protected Route Always Redirects to Login during refresh page
- React router is just showing a blank page after I structure like the şmage below
- React router dom renders a blank page
- React Router not working after the page refresh
- refreshing / maunally typing url gives blank page - React router dom 6
- react-router-dom. Return blank page after refresh
- React router dom render blank page
- React production router 404 after deep refresh firebase
- Getting blank page after react app publish in github
- Navigate to page after authentication using React Router v4
- Redirecting using React Router shows blank page
- React Redux with redux-observable use the router to navigate to a different page after async action complete
- Using React Router to Redirect to next page after successful login
- React Router how to return 404 page in case of dynamic routes expecting a parameter?
- React Router v6 rendering blank page
- React Router doesn't load the new page component after redirecting via navigate
- React Router master-detail: children component don't render new view until page refresh
- React Router scroll page to the top after transition
- React Router Still Renders Previous Page after Routing to New Component
- React Router v4 login check after hitting Refresh on browser
More Query from same tag
- Having css property in variable in react hooks
- How to integrate loading screen on route change with redux in Next.js
- Calling setstate after processing forEach within useEffect
- Is there way to set default value to prop which is child of required prop?
- ReactJS. How to get states of elements inside react component
- No 'Access-Control-Allow-Origin' header is present on the requested resource (FLASK API / ReactJs)
- Import custom tag to TypeScript
- Where do I find the object names of icons in the FontAwesome free packages?
- Firebase update method produces Promise Rejection
- How can I set validation rules when all fields are empty React Hook Form
- How to fly to a location in react-leaflet
- How to render in code generated SVG on ReactJS?
- Edit the url sent in confirmation email dj_rest_auth
- How to add react to an existing express multipage project with ejs?
- Input react wrapper
- Idiomatic migration of css class which was used on multiple elements to styled-components
- How to deploy browserHistory based React applications to Azure App Service?
- Update element on updating react state array
- Big list performance with React
- Reactjs BigCalendar Adding Event
- Fetch all images of an array in a object in my react app
- React router error Cannot read property 'forEach' of undefined
- Search in Redux store if specific string exists in messages array
- React component is re-rendering infinitely
- Rendering JavaScript Object in React
- React projects npm start not working says localhost rufused to connect
- Error deploying Gatsby JS site to Netlify - “Error running command: Build script returned non-zero exit code”
- NextJS React app styled component not rendering correct: Warning: Prop `className` did not match
- HOC which passes all props
- Summernote rich text editor-restrict image above particular height and width