MCPcopy Create free account
hub / github.com/Free-APIs/Free-APIs.github.io / ScrollToTop

Function ScrollToTop

src/components/ScrollToTop/index.js:4–12  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2import { useLocation } from 'react-router-dom';
3
4function ScrollToTop() {
5 const { pathname } = useLocation();
6
7 useEffect(() => {
8 window.scrollTo(0, 0);
9 }, [pathname]);
10
11 return null;
12}
13
14export default ScrollToTop;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected