Scroll to top on navigation

[MAILPOET-2129]
This commit is contained in:
Pavel Dohnal
2019-07-22 15:52:57 +02:00
committed by M. Shull
parent 7dde2149dd
commit 94a25f3f1c
3 changed files with 67 additions and 52 deletions

View File

@@ -0,0 +1,12 @@
import { useEffect } from 'react';
import { withRouter } from 'react-router-dom';
const ScrollToTop = ({ children, location: { pathname } }) => {
useEffect(() => {
window.scrollTo(0, 0);
}, [pathname]);
return children || null;
};
export default withRouter(ScrollToTop);