<reponame>Neerajjr11/ZS-PRIZE<filename>FrontEnd/src/components/PrivateRoute.js<gh_stars>0import React from "react";
import { useSelector } from "react-redux";
import LoadingToRedirect from "./LoadingToRedirect";

const PrivateRoute = ({ children }) => {
    const { user } = useSelector((state) => ({ ...state.auth }));
    return user ? children : <LoadingToRedirect />;
};

export default PrivateRoute;