mirror of
https://github.com/PlayEdu/backend
synced 2025-06-28 10:44:19 +08:00
13 lines
317 B
TypeScript
13 lines
317 B
TypeScript
import { useLayoutEffect } from "react";
|
|
import { useLocation } from "react-router-dom";
|
|
|
|
const AutoScorllTop = ({ children }) => {
|
|
const location = useLocation();
|
|
useLayoutEffect(() => {
|
|
document.documentElement.scrollTo(0, 0);
|
|
}, [location.pathname]);
|
|
return children;
|
|
};
|
|
|
|
export default AutoScorllTop;
|