title: Using setTimeout() in React and Testing it
body: <p>I realized that I have been using <code>setTimeout()</code> in my project -maybe- more than I should, I did a quick research and scroll through some open source react projects on Github and decided I should ask about it.</p>
  
  <p>I use <code>setTimeout</code> mostly for changing the classname or adding styles to animate the DOM objects also using CSS transition, one point I thought it will be hard to write unit testing with this many setTimeout.</p>
  
  <p>Since I came from using AngularJS, there is a <code>$timeout</code> service which has the same functionality with setTimeout, but in testing you can flush the timeout like <code>$timeout.flush()</code> and the timeout ends instantly.</p>
  
  <p><strong>My questions;</strong></p>
  
  <ul>
  <li>Is there an alternative testable way that I can use instead setTimeout (logicly or programaticly)?</li>
  <li>Is there any builtin testable function in React does the same thing with <code>setTimeout</code>?</li>
  <li>Is there any react addons I can use for "flushable" timeout?</li>
  </ul>
  
  <p>Keep in mind I'm fairly new at reactjs and haven't write any unit test on it yet.</p>