{"size": 219, "ext": "js", "max_stars_repo_path": "src/components/PrivateRoute.js", "max_stars_repo_name": "WaterMyPlantFriends/front-end", "max_stars_repo_stars_event_min_datetime": "2021-12-19T19:58:50.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-19T19:58:50.000Z", "max_issues_repo_path": "src/components/PrivateRoute.js", "max_issues_repo_name": "WaterMyPlantFriends/front-end", "max_issues_repo_issues_event_min_datetime": "2021-12-21T05:41:16.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-23T13:49:20.000Z", "max_forks_repo_path": "src/components/PrivateRoute.js", "max_forks_repo_name": "WaterMyPlantsApp/front-end", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 19, "max_forks_count": null, "avg_line_length": 36.5, "max_line_length": 64, "alphanum_fraction": 0.7123287671}
import { Navigate } from "react-router-dom";

export default function PrivateRoute({ children, redirectTo }) {
    const token = localStorage.getItem("token");
    return token ? children : <Navigate to={redirectTo}/>
}