I’ve been working on the Camper Leaderboard (on codepen here), and although I’ve almost completed the challenge, I could never figure out how to use the lifecycle methods correctly.
While using the lifecycle method componentDidUpdate() to call the API when toggling between brownie points, but when I put any function within that lifecycle it would call that function hundreds of times until it timedout. Even if I put a function that had nothing to do with an API call, it would still run seemingly forever. However, it only ran once (after an update) when placing a console.log() there.
I eventually gave up figuring out why and made the site work a different way, but I’m still curious as to what was really going on.
Runs w/out problem
Causes big problems!