React routes distribution issue

I used context api to manage login and login out state
I’m trying to divide the routes on the basis of logged in and log out

let rotues;
  // if(isLoggedIn){
  //   routes=();
  // }
  // else{
  //   routes=(

  //   )
  // }

then insert them inside

      <Router>
      <main>
        <Switch>
{routes}
</Switch>
</main>
<Router>

I did that and all of my components were visible in a single page
one after other

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.