DocSpace-buildtools/web/ASC.Web.Common/src/components/Layout/ScrollToTop.js

16 lines
391 B
JavaScript
Raw Normal View History

import { useEffect } from "react";
import { useLocation } from "react-router-dom";
export default function ScrollToTop() {
const { pathname } = useLocation();
useEffect(() => {
2020-12-28 13:21:59 +00:00
const documentScrollElement = document.querySelector(
"#customScrollBar > .scroll-body"
);
2020-12-24 15:03:51 +00:00
documentScrollElement && documentScrollElement.scrollTo(0, 0);
}, [pathname]);
return null;
}