1

Does anyone know the complete sequence of reflux methods? I have this reflux store and its relation shown in the flow below:

component =(listen state)=> store =(listen)=> action =(listen trigger)=> component

That is the complete cycle, and I am trying to integrate this into socket.io

Code snippet:

Store:

export default Reflux.createStore({

  listenables: [action],

  init() {
    this.state = messages;
    this.registerListener();
  },

  registerListener() {
    msgSocket.on('message', (user, msgs) => {
      this.state.msg.push(`${user} : ${msgs}`);
      this.trigger(this.state);
    });
  },

  getInitialState() {
    return this.state;
  },

  onSendMessage(username, message) {
    msgSocket.emit('message', username, message);
  }

});

But I get this result:

[user: undefined,
user: myMessage]

Why does it seem its repeating? anyone knows?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.