lifecycle: componentWillReceiveProps called before componentDidMount
<p>If I understand correctly the React lifecycle of a Component should make sure that <code>componentDidMount</code> is called before <code>componentWillReceiveProps</code>. When I test this on the initial mount of a component it seems to work that way. But when the component is has already been mounted before and is remounted the order is the other way around. Is this the expected behavior? The following piece of code illustrates a potential bug that could be introduced this way:
</p>

<pre><code>class Example extends React.Component {
    componentDidMount() { 
        this.something = { foo: 'bar' };
    }
    componentWillReceiveProps(nextProps) {
        this.something.foo;
        // Throws a TypeError if this code is reached before
        // componentDidMount is called.
    }
}
</code></pre>