2022-07-06 04:15:11 +00:00
|
|
|
import { useEffect } from 'react';
|
|
|
|
import { useLocation, withRouter } from 'react-router-dom';
|
|
|
|
|
|
|
|
const ScrollToTop = (props) => {
|
2022-07-25 04:38:48 +00:00
|
|
|
let location = useLocation();
|
2022-07-06 04:15:11 +00:00
|
|
|
|
2022-07-25 04:38:48 +00:00
|
|
|
useEffect(() => {
|
|
|
|
window.scrollTo(0, 0);
|
|
|
|
}, [location]);
|
2022-07-06 04:15:11 +00:00
|
|
|
|
2022-07-25 04:38:48 +00:00
|
|
|
return props.children;
|
|
|
|
};
|
2022-07-06 04:15:11 +00:00
|
|
|
|
|
|
|
export default withRouter(ScrollToTop);
|