Skip to content
Discussion options

You must be logged in to vote

When you need to pass multiple arguments to the fetcher, you need to make sure that the key also gets changed based on those arguments or the cache key will be wrong and you'll get invalid/stale data.

You can simply construct the cache key as an object with all of the dependencies of the fetcher:

https://swr.vercel.app/docs/arguments.en-US#multiple-arguments

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by IdoBouskila
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