Using setTimeout on promise chain

To keep the promise chain going, you can’t use setTimeout() the way you did because you aren’t returning a promise from the .then() handler – you’re returning it from the setTimeout() callback which does you no good. Instead, you can make a simple little delay function like this: And, then use it like this: Here … Read more

setInterval in a React app

I see 4 issues with your code: In your timer method you are always setting your current count to 10 You try to update the state in render method You do not use setState method to actually change the state You are not storing your intervalId in the state Let’s try to fix that: This would result … Read more