When I am doing this:
navigate(
`${window.location.pathname}?query=${encodeURIComponent(
JSON.stringify(q)
)}`,
{ replace: true }
);
If I scroll down a little from the page, then change a <Select />
input value, which triggers an update to this query in the URL, react-router-dom is scrolling the page to the top. When I remove this navigate
code and change the select inputs, no jumping to the page top occurs, so it must be react-router-dom somehow. How do I disable or prevent this "jump to page top" behavior in react-router-dom?