Replies: 5 comments
-
You could use the Firebase JS client as fetcher, probably with a wrapper, but I’m not sure how useful it would be 🤔 |
Beta Was this translation helpful? Give feedback.
-
Realtime database and Firestore has their own optimized caching strategy so it's better to let them handle their own data. |
Beta Was this translation helpful? Give feedback.
-
Highly recommend checking out swr-firebase. I'm playing around with it now and it seems very well done. |
Beta Was this translation helpful? Give feedback.
-
@danoc wow I didn't know about that lib, it looks truly amazing. Thank you! |
Beta Was this translation helpful? Give feedback.
-
I did some research whether to implement swr-firestore or not for an own personal project. This is what I concluded and some of the distinctive features which I found. Happy to learn more! I'm far from understanding everything.
UPDATE: I did run exactly into this situation https://swr.vercel.app/getting-started#example . I wanted to fetch the same firestore document in two different components on the page and at the same time I didn't want to separate logic of fetching from those components into the common container with one fetch (as it would create parent-child dependency, duplication of logic across containers etc.). At the same time I didn't want to create two requests to be billed with 2 reads from firestore. This exactly solves the problem of implementing |
Beta Was this translation helpful? Give feedback.
-
Question : Is it a good strategy to use swr with firebase ?
Beta Was this translation helpful? Give feedback.
All reactions