Add timer usage for es6

Summary: Closes https://github.com/facebook/react-native/pull/5401

Differential Revision: D3102058

fb-gh-sync-id: 953a69a2a50b7177a4b0ee01972f5d32d5476f5c
fbshipit-source-id: 953a69a2a50b7177a4b0ee01972f5d32d5476f5c
This commit is contained in:
sunnylqm 2016-03-26 05:41:33 -07:00 committed by Facebook Github Bot 2
parent 235b16d932
commit 7289222535

View File

@ -74,4 +74,6 @@ var Component = React.createClass({
});
```
We strongly discourage using the global `setTimeout(...)` and recommend instead that you use `this.setTimeout(...)` provided by react-timer-mixin. This will eliminate a lot of hard work tracking down bugs, such as crashes caused by timeouts firing after a component has been unmounted.
This will eliminate a lot of hard work tracking down bugs, such as crashes caused by timeouts firing after a component has been unmounted.
Keep in mind that if you use ES6 classes for your React components [there is no built-in API for mixins](https://facebook.github.io/react/blog/2015/01/27/react-v0.13.0-beta-1.html#mixins). To use `TimerMixin` with ES6 classes, we recommend [react-mixin](https://github.com/brigand/react-mixin).