Enterprise-CMCS/macpro-mako

View on GitHub
react-app/src/components/ScrollToTop/index.ts

Summary

Maintainability
A
0 mins
Test Coverage
F
20%
import { useEffect } from "react";
import { useLocation } from "react-router";

export const ScrollToTop = () => {
  const { pathname } = useLocation();

  useEffect(() => {
    window.scrollTo(0, 0);
  }, [pathname]);

  return null;
};