web-backset.cn/apps/web/src/router/Guard.tsx
2023-03-05 17:17:04 +08:00

17 lines
373 B
TypeScript

import React, { useEffect } from "react";
import { useLocation } from "react-router-dom";
interface IGuardProps {
children: JSX.Element;
}
export const Guard = (props: IGuardProps) => {
const location = useLocation();
useEffect(() => {
console.log("location.pathname changed 拦截", location.pathname);
}, [location.pathname]);
return props.children;
};