React Native setState(…) warning with both componentWillMount and componentDidMount
<p>I'm starting with react-native and in my project I got to a point where everything works but there's this warning:</p>

<p><code>Warning: setState(...): Can only update a mounted or mounting component.</code></p>

<p>So, I've looked several QA, tried a few solutions(changing the <code>setState()</code> call from <code>componentWillMount</code> and <code>componentDidMount</code>) but... the warning is always there.</p>

<p>Here is part of the code:</p>

<pre><code>REQUEST_URL = 'http://url/users.php';

(...)

module.exports = React.createClass({
    getInitialState: function() {
        return {
            uid: null,
            bid: null,
            username: null,
        }
    },

    componentDidMount: function() {
        this.fetchData();
    },
    fetchData: function() {
        fetch(REQUEST_URL)
            .then( (response) =&gt; response.json() )
            .then( (json) =&gt; {
                console.log('setState called');
                this.setState({
                    uid: json.users[0].user_id,
                    bid: json.users[0].building_id,
                    username: json.users[0].username
                });
            })
            .done();
    },
    render: function() {
        if (!this.state.uid) { //user is not defined
            console.log('not rendered');
            return &lt;Text&gt;chargement...&lt;/Text&gt;
        }
        // else
        console.log('rendered');
        var userId = this.state.uid;
        var buildingId = this.state.bid;
        var username = this.state.username;

        return (
            &lt;View style={styles.content}&gt;
                &lt;Text style={styles.label}&gt;User Id&lt;/Text&gt;
                &lt;Text&gt;{userId}&lt;/Text&gt;

                &lt;Text style={styles.label}&gt;Building Id&lt;/Text&gt;
                &lt;Text&gt;{buildingId}&lt;/Text&gt;

                &lt;Text style={styles.label}&gt;Username&lt;/Text&gt;
                &lt;Text&gt;{username}&lt;/Text&gt;
            &lt;/View&gt;
        )
    },
});
</code></pre>

<p>The <code>users.php</code> returns a json content-type.</p>

<p>Any clues?</p>

<p>Thanx.</p>