I made a mistake implementing a React Hook and got a denial of service from my backend

added by JavaScript Kicks
12/20/2018 9:23:14 AM

293 Views

This seemingly simple usage of React's useEffect hook on a Firebase endpoint accidentally ran through my 50k reads/day quota in minutes. The effect isn't dependent on any state changing so I omitted the second parameter. What I failed to realize was that everytime setMeeting was called the body of the function would be executed again, causing a loop in the data fetching.


0 comments