import { Redirect, Route } from "react-router-dom"; import { useAuth } from "./AuthProvider"; const PrivateRoute = ({ component: Component, ...rest }) => { const [logged] = useAuth(); return ( logged ? : } /> ); }; export default PrivateRoute;