Window.scrollTo () in reaction components?

Where do I need to place a call window.scrollTo(0,0)in a response component?

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.

- Change -

The problem was the height / overflow of the CSS window and body.

See: stack overflow.squite

+4
source share
1 answer

Ok, window.scrollTo (0,0) will always stick to the top of the page.

, componentDidMount, , . , , y, window.scrollTo, . , .

+9

All Articles