score:3

Accepted answer
function Auth({ component: Component, ...rest }) {
  const counter = useSelector(state => state);
  return (
    <Route
      {...rest}
      render={props =>
        counter ? <Component {...props} /> : <Redirect to="/sign" />
      }
    />
  );
}
export default Auth

score:1

 <PrivateRoute exact path='/Cart' component={EditPost} />

score:4

<PrivateRoute
    exact
    path="/Cart"
    component={Cart}
    isAuthenticate={() => checkAuth()} // or whatever method you use for checking auth
/>

Related Query

More Query from same tag