命令行
npm i react-timer-mixin --save
在项目中需要引入并注册:
var React = require('react');
var TimerMixin = require('react-timer-mixin');
var Component = React.createClass({
mixins: [TimerMixin],
componentDidMount() {
this.setTimeout(
() => { console.log('I do not leak!'); },
500
);
}
});