Reputation: 3
I am using parse as my app back-end, but I am unable to receive data with the observe() method, although I'm sure that react is properly connect with parse, because I can mutate data with the ParseReact.mutation.
import React from 'react';
import Parse from 'parse';
import ParseReact from 'parse-react';
const pinRegister = React.createClass({
mixins: [ParseReact.Mixin],
observe() {
return {
pins: (new Parse.Query('Pin'))
},
render() {
return {
<ul>
{this.data.pins.map(function(pin) {
return <li>{pin}</li>;
})}
</ul>
}
}
});
On the console I receive this message: "WebSocket connection to 'ws://mywsaddress:8080/parse' failed: Connection closed before receiving a handshake response" and the this.data.pins gets undefined,I checked the data in parse-dashboard and the Pin class has the properly data.
Edit: I add the liveQuery on my parse server, and the socket error stopped, but I'm still unable to receive data, on chrome's console I get this: Uncaught TypeError: this._subscriptions[name].dispose is not a function, and this problem comes from this peace of code from parse-react:
_unsubscribe: function _unsubscribe() {
for (var name in this._subscriptions) {
this._subscriptions[name].dispose();
}
this._subscriptions = {};
},
Upvotes: 0
Views: 235
Reputation: 7026
You are not included ParseReact.Mixin correctly. Replace "mixis" on "mixins".
mixins: [ParseReact.Mixin]
Upvotes: 1