Route GuardAuth GuardFor React How to work ? A private route can be protected using this AuthGuard component. It decides whether to permit navigation to a requested route. AuthGuard.jsx_13import { Navigate, useLocation } from "react-router-dom";_13import useAuth from "hooks/useAuth";_13_13const AuthGuard = ({ children }) => {_13 const { pathname } = useLocation();_13 const { isAuthenticated } = useAuth();_13_13 if (isAuthenticated) return <>{children}</>;_13_13 return <Navigate replace to="/login" state={{ from: pathname }} />;_13};_13_13export default AuthGuard; How to use it ? routes.js_14import { AuthGuard } from "components/auth";_14_14const routes = () => {_14 return [_14 {_14 path: "dashboard",_14 element: (_14 <AuthGuard>_14 <Dashboard />_14 </AuthGuard>_14 ),_14 },_14 ];_14};AWS AmplifyFor NextJS