Created
July 6, 2018 02:40
-
-
Save amiyasahu/d839aed86d1d0e793aa3926c2d43c3f0 to your computer and use it in GitHub Desktop.
Scroll into view after the component is loaded in react
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import ReactDOM from 'react-dom'; | |
class ScrollToComponent extends Component { | |
componentDidMount() { | |
ReactDOM.findDOMNode(this).scrollIntoView(); | |
} | |
render() { | |
return ( | |
<div className="ScrollToComponent" /> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment