import React, { useContext } from "react"; import { BrowserRouter, Route, Switch, Redirect } from "react-router-dom"; import { AuthContext, AuthProvider } from "./Context/Auth/AuthContext"; import Dashboard from "./pages/Home/Dashboard"; import Chat from "./pages/Chat/Chat"; import Profile from "./pages/Profile/Profile"; import Signup from "./pages/Signup/Signup"; import Login from "./pages/Login/Login"; import WhatsAuth from "./pages/WhatsAuth/WhatsAuth"; const PrivateRoute = ({ component: Component, ...rest }) => { const { isAuth, loading } = useContext(AuthContext); if (loading) return

Loading...

; return ( isAuth ? ( ) : ( ) } /> ); }; const PublicRoute = ({ component: Component, ...rest }) => { const { isAuth, loading } = useContext(AuthContext); if (loading) return

Loading...

; return ( !isAuth ? ( ) : ( ) } /> ); }; const Routes = () => { return ( ); }; export default Routes;