Hey Melanie, I can see there are lots of good responses to your stack overflow question already. However, it seems that it’s not a Firestore issue at the root, but more that useEffect is causing the firestore call to be re-run.
I can see that you have used orgList
in your dependency array for useEffect, which means every time it changes the function will run again. Then inside the use effect function you have changed the value of orgList
by calling setOrgList
.
This is going to cause useEffect to be run infinitely and give you lots of calls to firebase in quick succession!
I did a very similar thing early on, putting a date value in the dependency array and setting a new date on each render…
Also, side note, as Gustavo Hoirisch mentions in his so response, orglist is an array and it can cuase problems using an array or an object as the thing useEffect is looking at in the dependancy array. I try to avoid it.