如何导入类库

命令行

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

);

}

});

你可能感兴趣的:(如何导入类库)