title: How to use babel-plugin-rewire with React?
body: <p>I'm seeing this error: </p>
  
  <pre><code> ✖ should dispatch profileAction
        PhantomJS 1.9.8 (Linux 0.0.0)
      TypeError: 'undefined' is not a function (evaluating '_Header2.default.__Rewire__('profileAction', function (a) {
            a();
          })')
          at     /home/piousbox/Dropbox/projects/colombia_tailors_react/app/app.tests.js:74904 &lt;- webpack:///app/components/App/__tests__/Header-test.jsx:23:53
  </code></pre>
  
  <p>My test looks like this:</p>
  
  <pre><code>  it('should dispatch profileAction', (done) =&gt; {
      Header.__Rewire__('profileAction', (a) =&gt; { a() })
      let r = ReactTestUtils.renderIntoDocument(
        &lt;Provider store={store}&gt;
          &lt;Header router={{location:{}}} /&gt;
        &lt;/Provider&gt;)
      let elem = ReactDOM.findDOMNode(r)
    })
  </code></pre>
  
  <p>My production code looks like this:</p>
  
  <pre><code>import { profileAction } from '../../actions/profileActions'
  profileAction // eslint-disable-line no-unused-expressions
  class Header extends React.Component {
    constructor(props) {
      super(props)
      props.dispatch(profileAction())
    }
    render () { ... }
  }
  </code></pre>
  
  <p>What am I doing wrong? I am looking to assert that profileAction() was called when the component Header was mounted.</p>