Reactjs/Flux/altjs监听商店更改减慢应用程序

Reactjs/Flux/altjs监听商店更改减慢应用程序,reactjs,flux,reactjs-flux,reactjs-native,alt.js,Reactjs,Flux,Reactjs Flux,Reactjs Native,Alt.js,我需要在每个按钮上更新商店,点击listView并相应地更改按钮状态图标。以下是一个数组 componentWillMount: function() { FollowingStore.listen(this.onChange); }, componentWillUnmount: function() { FollowingStore.unlisten(this.onChange); }, onChange: function(state) { this.setState({unfol

我需要在每个按钮上更新商店,点击listView并相应地更改按钮状态图标。以下是一个数组

componentWillMount: function() {
 FollowingStore.listen(this.onChange);
 },

componentWillUnmount: function() {

FollowingStore.unlisten(this.onChange);
},
onChange: function(state) {
 this.setState({unfollowing_ids: state.unfollowing_ids});
},

实现这一目标的有效途径是什么

我找到的解决方案。如果你不需要商店,就不要去听。我每次点击按钮都会更新store并更新local array。因此local array和store array正在同步,最后从另一个屏幕返回时,我只会得到
followingstore.getState()。取消跟踪数组
,并删除
componentDidMount()
方法中的那些项。这对我有用。如有其他建议,将不胜感激

干杯