import * as React from 'react' ; export class ScrollIntoView extends React . PureComponent < IProps , IState > { private ref : React . RefObject < any > ; constructor ( props , context ) { super ( props , context ) ; this . ref = React . createRef ( ) ; } public render ( ) { return ( < div ref = { this . ref } > { this . props . children } < /div>); } public componentDidMount ( ) { if ( this . ref ) { if ( this . ref . current ) { this . ref . current . scrollIntoView ( ) ; } else { console . warn ( "No current" ) ; } } else { console . warn ( "No ref" ) ; } } } interface IProps { } interface IState { }