scrollers.tsx 310 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import * as React from 'react';

// Nicked from
// https://reacttraining.com/react-router/web/guides/scroll-restoration
export class ScrollToTopOnMount extends React.Component {
  public componentDidMount() {
    if (window) {
      window.scrollTo(0, 0);
    }
  }

  public render() {
    return null;
  }
}