I have three different things going on in my application:
- A Timer is set at 10 second intervals and does't stop until asked to
- An async Api Utility module triggers a function to call an Api once the timer starts over again.
- I have a Component (w/ accompanying Action and Store modules) that takes the api data (a list of similar items with the same Properties) and renders them to the page.
My question is this:
Where and When do I initialize the timer to being so that my Component can start receiving data after its
render()
method is invoked?
I've considered putting it inside the render
function before the return is reached but that doesn't make sense as I need the api data rendered to the page as soon as the data is received.
Am I structuring this application incorrectly? should my Timer and/or Api utilities be React Components too?