Skip to content
Discussion options

You must be logged in to vote

react-query doesn't actively do something with scroll restoration - the browser does that :) If you change the key and have no data, you will be in loading state. If you change the key and already have data, the data from the cache will be returned. if you are on page 3, and you change the key, and you also get 3 pages for the new key from the cache, your scroll position will stay where it is. Is that what you mean? If so, I think you'd need a useEffect that scrolls to the top whenever the key changes

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by FinPlorer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants