mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-02 13:51:48 +00:00
15 lines
337 B
TypeScript
15 lines
337 B
TypeScript
import { FC, PropsWithChildren, useEffect } from 'react';
|
|
import { useLocation } from 'react-router-dom';
|
|
|
|
const ScrollToTop = (): FC<PropsWithChildren<unknown>> => ({ children }) => {
|
|
const location = useLocation();
|
|
|
|
useEffect(() => {
|
|
scrollTo(0, 0);
|
|
}, [location]);
|
|
|
|
return <>{children}</>;
|
|
};
|
|
|
|
export default ScrollToTop;
|