react-scroll-to-component
react-scroll-to-component copied to clipboard
Is it possible to scroll to component after the component shown?
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
add dummy elements containing no children but visible as anchor hooks
{ this.ExtraComponent = section }}>
{props.example_shown && (