Where do I need to place a call window.scrollTo(0,0)in a response component?
window.scrollTo(0,0)
I tried to put it right in render, and also tried componentDidUpdate(wait until everything is rendered), but somehow the scrollbars always remain in the same position.
render
componentDidUpdate
- Change -
The problem was the height / overflow of the CSS window and body.
See: stack overflow.squite
Ok, window.scrollTo (0,0) will always stick to the top of the page.
, componentDidMount, , . , , y, window.scrollTo, . , .