title: Listen to window.onmessage in React Component
body: <p>I'm trying to listen for a postmessage in my react class.  It isn't working.</p>
  <pre><code>export default class App extends React.Component {
    constructor(props) {
      super(props);
      this.handleMessage = this.handleMessage.bind(this);
    }
    componentDidMount(){
      window.addEventListener(&quot;onmessage&quot;, this.handleMessage);
    }
    componentWillUnmount() {
      window.removeEventListener('onmessage', this.handleMessage);
    }
    handleMessage(e){
      console.log('me?')
    }
  }
  </code></pre>
  <p>I send the message like this:</p>
  <pre><code>window.opener.postMessage('a message', '*');
  </code></pre>
  <p>I know the message is getting to the window, because I can successfully listen to it in the plain JS file that loads the react app. However listening for it in react as above does not work.</p>
  <p>Why isn't my listener every being triggered, how can I debug it?</p>