Reputation: 17323
I have a React component that observes data on a Parse server.
mixins: [ParseReact.Mixin],
observe: function() {
var query = new Parse.Query('Item');
return {
items: query
};
}
In the render
method I do receive my items
and that work well. But, I want to be able to listen for when this.data.items
will change it's value.
I'm aware of the regular lifecycle methods, but in them I have no way of checking if this.data.items
is the same as before the update.
componentWillUpdate: function(nextProps, nextState) {},
componentDidUpdate: function(prevProps, prevState) {},
How do I do that?
Upvotes: 0
Views: 190
Reputation: 558
You mean you need a "receiving data" callback?
Now there are no such a callback.
See this issue.
You can override "_receiveData" function in class extended ParseComponent by yourself though I'm not sure it's the right way for your situation.
_receiveData(name, value) {
this.data[name] = value;
delete this._pendingQueries[name];
delete this._queryErrors[name];
this.forceUpdate();
}
Upvotes: 1