title: Run background tasks in ReactJS
body: <p>Is it possible to have a task run in the background of a ReactJS application?</p>
  
  <p>I have an application that consists out of two components. One of these components displays a countdown. I use <code>setInterval(this.updateTimer, 1000);</code> to have a function <code>updateTimer</code> called, to update the state.
  This works as long as the user stays on that component. If the user changes to the other component the following error occurs:
  <code>Warning: setState(...): Can only update a mounted or mounting component.</code></p>
  
  <p>I understand what the error means and what is causing it.</p>
  
  <p>What I'm looking for is to have the state of that component updated in the background. (Which can't be done since it is unmounted.) Furthermore a notification is displayed when the countdown reaches 0. This also needs to happen, while the component is not mounted.</p>
  
  <p>Is there a concept/helper for something like this? The only solution I could came up with was to have a websocket connection. The timer would run on the back end and via websocket inform the front end when the countdown reaches 0.</p>