In my SPA, I have a list of <Link> that point to a Viewer component route that uses withRouter. When the user navigates to the Viewer, withRouter pushes state and history to it. In the Viewer, I am using
this.props.history.goBack()
in a <BackArrow> component, and it works to restore the location, but not the scroll position in the list and returns the window to the top.
Is this expected with goBack()?
AFAIK, using scrollIntoView as mentioned here will not work with since ref cannot be assigned to functional components, and getElementById cannot find an id assigned to a component rendered element.