Untitled
unknown
plain_text
2 years ago
303 B
9
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