react-scroll-to-component icon indicating copy to clipboard operation
react-scroll-to-component copied to clipboard

Is it possible to scroll to component after the component shown?

Open ivanasetiawan opened this issue 7 years ago • 1 comments

I need to scroll to the component after it gets rendered to the page. The component itself is not shown bu default (the component will be rendered when example_shown is true). Something like this: {props.example_shown && ( <ExtraComponent /> )}

and inside the ExtraComponent, I give ref={(section) => { this.ExtraComponent = section }}. I tried to call scrollToComponent inside componentDidMount() but this.ExtraComponent returns to null. How can I scroll to position

ivanasetiawan avatar Apr 06 '18 09:04 ivanasetiawan

add dummy elements containing no children but visible as anchor hooks

{ this.ExtraComponent = section }}>
{props.example_shown && ( )}

syntithenai avatar Apr 11 '18 00:04 syntithenai