Skip to content
Discussion options

You must be logged in to vote

In general, I think, the cache should be considered an implementation detail. You can access it directly, but you're missing out on some of useSWR's abstractions, which can make things more complicated.

In this particular case, I don't see a way in the useSWR API to do what you're wanting, so accessing the cache seems fine. (If it helps, you're not using cache as arbitrary global state; you're just using it for more fine-grained read-only knowledge of useSWR's own behavior.)

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@joshkel
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@MightyMoud
Comment options

Answer selected by MightyMoud
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