Nic*_*.Xu 3 ecmascript-6 reactjs
我从这篇文章中了解到了这一点.
function StoreMixin(...stores) { // what is "..."
var Mixin = {
getInitialState() {
return this.getStateFromStores(this.props);
},
componentDidMount() {
stores.forEach(store =>
store.addChangeListener(this.handleStoresChanged)
);
this.setState(this.getStateFromStores(this.props));
},
componentWillUnmount() {
stores.forEach(store =>
store.removeChangeListener(this.handleStoresChanged)
);
},
handleStoresChanged() {
if (this.isMounted()) {
this.setState(this.getStateFromStores(this.props));
}
}
};
return Mixin;
}
Run Code Online (Sandbox Code Playgroud)
请用示例代码解释什么是"...".谢谢!
归档时间: |
|
查看次数: |
3730 次 |
最近记录: |