Skip to content

Do I need a state management tool? #468

Answered by jhuleatt
adamfarmer0 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @adamfarmer0, thanks for your question. The main reason to use a state management tool would be if you have very complex app state outside of Firebase. In terms of just fetching some data from Firestore and rendering it, no state library is needed. Take a look at the ReactFire docs to see how to render a list of data from Firestore.

To answer your specific questions:

Does the app sends a read call to firestore each time the component re-renders?

No, reads shouldn't be re-issued. ReactFire caches the active Firestore listeners, so as long as your query doesn't change, it will keep the active listener open instead of creating a new one.

Is it okay to write this kind of code for other …

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@adamfarmer0
Comment options

@jhuleatt
Comment options

@MichaelVidStep
Comment options

@jhuleatt
Comment options

Answer selected by adamfarmer0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants