I am trying to make an api request every minute based on a set of conditions. The issue Im having is the props I am reading are updating every 3 seconds so if I create a function with a setTimeout or any timer method inside seems to reset every 3 seconds so it can never make it to one minute. I am new to dev and Ive never done anything like this, any advice would be helpful. Thanks!
Settimeout only work once you need to use setinterval instead it will repeat every 3 second You can make 2 interval one run every 3 second and the other every minute Or you can make variable every time the function run increment it by 1 and every time this variable is divisable by 20 (mean 60 sec passed) you can call the api