Open bobiblazeski opened 8 years ago
Jup, just point to the container where you want to scroll to the top and set scrollTop = 0
. You do this in the component where you need to scroll to the top and check if the url has changed. Like:
componentDidUpdate(prevProps) {
if (prevProps.url !== this.props.url) {
this.refs.mainContainer.scrollTop = 0;
}
}
Is it possible to scroll automatically to top of the page on route change like https://github.com/rackt/react-router/blob/21f4f577774233e6ad3c78103fbdbad39ba69ff6/docs/api/components/Route.md#preservescrollposition