Created ScrollToTop test

This commit is contained in:
Alejandro Celaya
2019-01-13 23:03:31 +01:00
parent d020ed0b13
commit 056286636d
2 changed files with 31 additions and 2 deletions

View File

@@ -7,10 +7,10 @@ const ScrollToTop = ({ scrollTo }) => class ScrollToTop extends React.Component
children: PropTypes.node,
};
componentDidUpdate(prevProps) {
componentDidUpdate({ location: prevLocation }) {
const { location } = this.props;
if (location !== prevProps.location) {
if (location !== prevLocation) {
scrollTo(0, 0);
}
}