i need to update Store on every button click on listView and change button state icon accordingly. unfollowing_ids is an array.
componentWillMount: function() {
FollowingStore.listen(this.onChange);
},
componentWillUnmount: function() {
FollowingStore.unlisten(this.onChange);
},
onChange: function(state) {
this.setState({unfollowing_ids: state.unfollowing_ids});
},
what is the efficient way to achieve.
The Solution that i found. Do not listen for store if you don't need it. I updates store on every button click and update local array.So local array and store array are getting sync and finally on returning back from another screen I just get FollwingStore.getState().unfollowing_array
and removes those items in componentDidMount()
Method. This works for me. Any other suggestion would be appreciated.
Cheers