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

14 lines
364 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-24 15:03:51 +00:00
const documentScrollElement = document.getElementById("customScrollBar");
documentScrollElement && documentScrollElement.scrollTo(0, 0);
}, [pathname]);
return null;
}