Login page shows up for a second after refreshing on dashboard

my code looks like this on app.js after logging in it goes to dashboard page but there when I refresh the page login page shows up for second

 {
        loggedIn ? (    
            <Dashboard path = "/dashboard/customers" loggedIn={loggedIn} setLoggedIn={setLoggedIn} />
          ) : (
            <Login path = "/dashboard/signin" onSignIn={onSignIn}> </Login>  
        ) 
      }