2020-12-15 11:08:14 +00:00
|
|
|
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);
|
2020-12-15 11:08:14 +00:00
|
|
|
}, [pathname]);
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|