How to call an API every minute for a Dashboard in React?

Posted by Andre Scott | Updated on

Want to call an API every minute for a Dashboard in React? In order to use await, the function directly enclosing it needs to be async. According to you if you want to use setInterval inside componentDidMount, adding async to the inner function will solve the issue.

Here is the code:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers