Repository navigation
Network-first, persisted cache fallback strategy using React Query #9863
Answered
by
TkDodo
bacarybruno
asked this question in
Q&A
|
Hello 👋 I’m working on a React Native app and I would like to implement the following strategy:
Is |
Answered by
TkDodo
Nov 26, 2025
Replies: 1 comment 9 replies
|
I guess, but your first and last point kinda contradict each other? “The app always tries the API first” does that also apply when the app restarts? I’m confused. Our persisters will always read from the persisted storage before trying any API requests, then you’ll get that data back and if its stale or there is no data, you’ll get a fetch. On the very first attempt, the data in the persisted storage is just empty so it’ll read that empty data and will make a request after that. |
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
then you need to build this yourself, likely by doing try/catch in the queryFn and then read from the fallback cache when you get an error.