score:1

Accepted answer
function App() {
  return (
    <div className="App">
      <Router>
        <AuthProvider>

          <Sidebar />

          <Routes />

        </AuthProvider>
      </Router>
    </div>
  );
}

function Routes() {
  const { currentUser } = useAuth()
  return (
    <Switch>
      {currentUser && <PrivateRoutes />}
      <PublicRoutes />
    </Switch>
  )
}


Related Query

More Query from same tag