title: Unable to make a class a mobx observer without decorator support - "TypeError Cannot read property 'observer' of undefined"
body: <p>Here is the <code>index.js</code> file</p>
  
  <pre><code>import React from "react";
  import ReactDOM from "react-dom";
  import mobx, { observable, action, decorate } from "mobx";
  import mobxReact from "mobx-react";
  
  import "./styles.css";
  
  const Main = mobxReact.observer(
    class Main extends React.Component {
      // @observable internalState = false;
      constructor(props) {
        super(props);
        this.internalState = false;
      }
  
      toggleMenu = () =&gt; {
        console.log("Toggle button");
        this.internalState = !this.internalState;
      };
  
      render() {
        return (
          &lt;div className="App"&gt;
            &lt;h1&gt;Toggle State&lt;/h1&gt;
            &lt;input type="button" onClick={this.toggleMenu} value="Toggle" /&gt;
            &lt;div style={{ paddingTop: "25px" }}&gt;
              internalState {this.internalState.toString()}{" "}
            &lt;/div&gt;
          &lt;/div&gt;
        );
      }
    }
  );
  
  decorate(Main, {
    internalState: observable,
    toggleMenu: action
  });
  
  function App() {
    return &lt;Main /&gt;;
  }
  
  const rootElement = document.getElementById("root");
  ReactDOM.render(&lt;App /&gt;, rootElement);
  </code></pre>
  
  <p>Here is the link to the <code>codesandbox</code> code: <a href="https://codesandbox.io/s/k37v35vylv" rel="nofollow noreferrer">https://codesandbox.io/s/k37v35vylv</a></p>
  
  <p>Since the template of this <code>codesandbox</code> does not support <code>decorator</code> syntax, I am trying to make the <code>Main</code> class an <code>observer</code> without <code>@observer</code>.</p>
  
  <p>I am getting this error:</p>
  
  <p><a href="https://i.stack.imgur.com/UktZm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UktZm.png" alt="enter image description here"></a></p>
  
  <p>The error text:</p>
  
  <pre><code>TypeError: Cannot read property 'observer' of undefined
  </code></pre>
  
  <p>The dependencies:</p>
  
  <p><a href="https://i.stack.imgur.com/fp7YC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fp7YC.png" alt="enter image description here"></a></p>