Q:

if(this.isMounted()) not being called?

Can you tell me why when I do this:
 var SomeComponent = React.createClass({

 getData: function(){

 if (this.isMounted()){

  var queryInfo = {
    userId: sessionStorage.getItem("user_id"),
    userRole: sessionStorage.getItem('user_role'),
    aptId : this.props.params
  }

  io = io.connect();
  io.emit('allTasks', queryInfo);
  io.on('allTasksInfo', function(data){
    reqwest({
      url: '/apartment/tasks/address',
      method: 'get',
      xhrFields: {withCredentials: true},
      crossOrigin: true
    }).then(function(data){
       this.setState({
         dataSet: arr
       })
    }.bind(this));
   }.bind(this));
  }
},

componentDidMount: function(){
    this.getData();
},

render: function(){...}

});

The code inside the if is executed, but I get the Uncaught Error: 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. 
But when I do this:
var SomeComponent = React.createClass({

getData: function(){

    var queryInfo = {
     userId: sessionStorage.getItem("user_id"),
     userRole: sessionStorage.getItem('user_role'),
     aptId : location.pathname.split("/")[4]
    }

    reqwest({
        url:'/operation/staff',
        method: 'get',
        xhrFields: {withCredentials: true},
        crossOrigin: true
    }).then(function(data){
        if(this.isMounted()){
            this.setState({
                operationStaff: data
            })
        }
    }.bind(this));
 }

 componentDidMount: function(){
   this.getData();
 },

 render: function(){...}

});

Everything is ok. Shouldn't the first just be executed when the component is mounted? What I am missing?
EDIT: I'm using react-router and express server with socket.io with server rendering (just the components, not the data - this I will fetch client side). After the answers, I can say:

The component is not unmounting
I can now tell that at first render, this warning doesn't appear even on second example:
https://drive.google.com/file/d/0B1rbX9C6kejlbWVKeTZ6WVdGN0E/view?usp=sharing

But if I change the url and get back to this path (and here yes, the component unmounts off course), the Ajax reqwest is being called 2 times
https://drive.google.com/file/d/0B1rbX9C6kejlUjFRYTBtejVLZGs/view?usp=sharing
This has something to do with the sockets implementation.
I will close this issue and open another regarding this. Thank you for the help.

A:

Shouldn't the first just be executed when the component is mounted?

Yes, and it is (what makes you think it is not?).
However, the Ajax callback itself is executed some time in the future and at that moment, the component may already be unmounted.
In the first example, the test is useless since the component is always mounted after componentDidMount was called. In the second example, you are testing whether the component is mounted just before you call setState, which makes more sense.
Here is a simplified example: 
var Hello = React.createClass({
    getInitialState: function() {
        return {name: 'foo'};
    },

    componentDidMount: function() {
        console.log('mounted...');

        setTimeout(function() {
            // this works fine
            console.log('updating state once...');
            this.setState({
                name: 'bar'
             });
        }.bind(this), 1000);

        setTimeout(function() {
            // this will throw
            console.log('updating state twice...');
            this.setState({
                name: 'baz'
             });
        }.bind(this), 3000);
    },

    componentWillUnmount: function() {
        console.log('unmounting...');
    },

    render: function() {
        return <div>Hello {this.state.name}</div>;
    }
});

React.render(
  <Hello />,
  document.getElementById('container')
);

setTimeout(function() {
    React.unmountComponentAtNode(
        document.getElementById('container')
    );
}, 2000);

If you run it you will notice that the second timeout will generate the same error because it is called after the component was unmounted:
Console output:
mounted...
updating state once...
unmounting...
updating state twice...
 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.

DEMO: https://jsfiddle.net/pkzfbcr5/

