andipaetzold/react-firehooks

How to refetch firestore data?

jasan-s opened this issue · 3 comments

How to refetch firestore data?

You can subscribe to data using useDocumentData(). That way you will always get the current data of a document.
With useDocumentDataOnce() you can fetch the data once. It is currently not possible to manually trigger a refresh/reload of the local data.

i see. i was looking to manually refetch.

I see two options atm:

  • Remount the component
  • Subscribe to the data and instead of refetching, you always copy the current data into a separate state