Untitled
Anonymous
plain_text
05/27/2024 9:51 AM
404 B
13
Indexable
import React from 'react';
import { Navigate } from 'react-router-dom';
import { useAuth } from '../context/AuthContext';
const PrivateRoute = ({ children }) => {
const { isAuthenticated } = useAuth();
return isAuthenticated ? children : <Navigate to="/login" />;
};
export default PrivateRoute;
Editor is loading...
Leave a Comment