Issue #6 Implementado scroll global

This commit is contained in:
Daniel Cortes
2020-06-19 11:50:26 -04:00
parent 76280a4f8c
commit 291ec0aa53
2 changed files with 19 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
import { useEffect } from 'react';
import { withRouter } from 'react-router-dom';
export const ScrollToTop = ({ history }) => {
useEffect(() => {
const unlisten = history.listen(() => {
window.scroll({top:0, left:0, behavior:'smooth'});
});
return () => {
unlisten();
}
}, []);
return (null);
}
export const ScrollToTopRouter = withRouter(ScrollToTop);