title: Can't call setState on a component that is not yet mounted
body: <p>this is the first time I face this warning message.</p>
  
  <blockquote>
    <p>Can't call setState on a component that is not yet mounted.</p>
  </blockquote>
  
  <p>Follows:</p>
  
  <blockquote>
    <p>This is a no-op, but it might indicate a bug in your application. Instead, assign to <code>this.state</code> directly or define a <code>state = {};</code> class property with the desired state in the MyComponent component.</p>
  </blockquote>
  
  <p>The "<strong><em>not yet mounted</em></strong>" part actually makes little to no sense as the only way to trigger the issue is to call a function by clicking a button from a component that needs to be mounted in order to see the button. The component is not unmounted at any given time neither.</p>
  
  <p>This dummy component reproduces the error in my app:</p>
  
  <pre><code>import PropTypes from 'prop-types'
  import React from 'react'
  
  export default class MyComponent extends React.Component {
    constructor (props) {
      super(props)
      this.state = {
        initial: 'state'
      }
      this.clickMe = this.clickMe.bind(this)
    }
  
    clickMe () {
      this.setState({
        some: 'new state'
      })
    }
  
    render () {
      return (
        &lt;div&gt;
          &lt;button onClick={this.clickMe}&gt;click&lt;/button&gt;
        &lt;/div&gt;
      )
    }
  }
  </code></pre>
  
  <p>I am using:</p>
  
  <pre><code>"react": "16.3.2",
  "react-dom": "16.3.2",
  "mobx": "4.2.0",
  "mobx-react": "5.1.2",
  </code></pre>
  
  <p>Did I miss something in the latest React/mobx version? (note the component does not use any mobx related stuff but its parent is a mobx-react observer)</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>There must be something related to the component instance, further investigation has shown that in some cases, creating an handler inside the render function will make this warning disappear, but not in all cases.</p>
  
  <pre><code>class MyComponent extends React.component {
    constructor (props) {
      // ...
      this.clickMeBound = this.clickMe.bind(this)
    }
  
    clickMe () {
      ...
    }
  
    render () {
      // works
      &lt;button onClick={() =&gt; {this.clickMe()}}&gt;click arrow in render&lt;/button&gt;
  
      // warning: Can't call setState on a component that is not yet mounted.
      &lt;button onClick={this.clickMeBound}&gt;click bound&lt;/button&gt;
    }
  }
  </code></pre>
  
  <p><strong>Edit 2:</strong></p>
  
  <p>I have removed 'react-hot-loader/patch' from my entries in my Webpack config and some weird issues like this one have disappeared. I'm not putting this as an answer because the error message itself is still weird and this causes a warning in the console. Everything works fine though.</p>