Files
shlink-web-client/src/common/ScrollToTop.tsx
2020-11-13 22:44:26 +01:00

13 lines
322 B
TypeScript

import { PropsWithChildren, useEffect } from 'react';
import { RouteComponentProps } from 'react-router';
const ScrollToTop = () => ({ location, children }: PropsWithChildren<RouteComponentProps>) => {
useEffect(() => {
scrollTo(0, 0);
}, [ location ]);
return <>{children}</>;
};
export default ScrollToTop;