reactjs - window.scrollTo() in react components? -


where have put window.scrollto(0,0) call in react component?

i tried put directly render , tried componentdidupdate (to wait till rendered), somehow the scrollbars stay @ same position.

-- edit --

the problem css height/overflow of window , body.

see: https://stackoverflow.com/a/18573599/1016383

well, window.scrollto(0,0) stick top of page.

you correct in saying code should live in componentdidmount function, need tell scroll. locate id of element want scroll , obtain it's y coordinates, enter window.scrollto , should work. may need height of component , add dymamic value obtained.


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -