title: ReactJs error - Warning: setState(...): Can only update a mounted or mounting component
body: <p>I am getting this error can anyone please tell me how I can debug this further?</p>
  
  <blockquote>
    <p>Warning: setState(...): Can only update a mounted or mounting
    component. This usually means you called setState() on an unmounted
    component. This is a no-op.</p>
  </blockquote>
  
  <p>Can anyone help?</p>
  
  <p>This is my component which is causing the error:</p>
  
  <pre><code>var postal = require('postal'),
  contactChannel = postal.channel("contact"),
  React = require('react');
  
  var ContactSelector = React.createClass({
  
  getInitialState: function() {
      return {
          selectedContacts:[]
      };
  },
  
  handleChange: function(e) {
      var id = e.target.attributes['data-ref'].value;
  
      if (e.target.checked === true){
          contactChannel.publish({
                      channel: "contact",
                      topic: "selectedContact",
                      data: {
                          id: id
                      }});
  
      } else{
          contactChannel.publish({
              channel: "contact",
              topic: "deselectedContact",
              data: {
                  id: id
              }
          });
  
      }
  },
  
  render: function() {
  
      var id = this.props.data.id;
      var isSelected = this.props.data.IsSelected;
  
      return (
          &lt;div className="contact-selector"&gt;
              &lt;input type="checkbox"
                  checked={isSelected} data-ref={id}
                  onChange={this.handleChange} /&gt;
          &lt;/div&gt;
      );
  }
  
  });
  module.exports = ContactSelector;
  </code></pre>
  
  <p>The contactChannel is a channel I've setup using postal.js, <a href="https://github.com/postaljs/postal.js" rel="nofollow">https://github.com/postaljs/postal.js</a></p>
  
  <pre><code> contactChannel.subscribe("selectedContact",function (data, envelope) {
  
          page.setPersonIsSelectedState(data.id, true);
  
          basketChannel.publish({
              channel: "basket",
              topic: "addPersonToBasket",
              data: {
                  personId: data.id
              }
          });
      });
  </code></pre>
  
  <p>I suscribe to the publish in componentDidMount on my parent page:</p>
  
  <pre><code>componentDidMount: function() {
      var page = this;
      this.loadContacts();
  
      page.subscribeEvents();
  },
  </code></pre>
  
  <p>Listeners:</p>
  
  <p>subscribeEvents: function() {</p>
  
  <pre><code>    var page = this;
  
      page.subscribeToChannel(filterChannel, "searchFilterChange", this.listenerForSearchFilterChanged);
  
      contactChannel.subscribe("pageSizeChanged", this.listenerForSizeChanged);
  
  
      page.subscribeToChannel(filterChannel, "genderFilterChange", this.listnerForGenderFilterChange);
  
      page.subscribeToChannel(filterChannel, "rollModeFilterChange", this.listnerForRollModeFilterChange);
  
      page.subscribeToChannel(filterChannel, "attendanceModeFilterChange", this.listnerForAttendanceModeFilterChange)
  
      page.subscribeToChannel(filterChannel, "messageToFilterChange", this.listnerForMessageToFilterChange);
  
      contactChannel.subscribe("selectAll", function (data) {
          page.loadContacts();
      });
  
  
      contactChannel.subscribe("selectedContact",function (data, envelope) {
  
          page.setPersonIsSelectedState(data.id, true);
  
          basketChannel.publish({
              channel: "basket",
              topic: "addPersonToBasket",
              data: {
                  personId: data.id
              }
          });
      });
  
      contactChannel.subscribe("selectAll", function (data, envelope) {
  
          basketChannel.publish({
              channel: "basket",
              topic: "selectAll",
              data: {
                  selectAll: data.selectAll
              }
          });
  
      });
  
      contactChannel.subscribe("refreshContacts", function (data, envelope) {
          page.loadContacts();
  
      });
  },
  </code></pre>