title: Redux cannot access action creator before initialization using mapDispatchToProps
body: <p>I've been trying to figure this out for a few hours now and can't make headway. </p>
  
  <p>Question: I'm getting an error "Cannot access  before initialization" on this line:</p>
  
  <pre><code>const mapDispatchToProps = { changeGreen };
  </code></pre>
  
  <p>I'm exporting my action creator from index like this:</p>
  
  <pre><code>export const changeGreen = () =&gt; {
    return {
      type: GREEN_ON
    };
  };
  </code></pre>
  
  <p>I'm importing into MyComponent.js like so: </p>
  
  <pre><code>import { changeGreen } from "./index";
  </code></pre>
  
  <p>I'm mapping to dispatch in the component file like so: </p>
  
  <pre><code>const mapDispatchToProps = { changeGreen };
  
  export default connect(
    mapStateToProps,
    mapDispatchToProps
  )(MyComponent);
  </code></pre>
  
  <p>My App.js looks like: </p>
  
  <pre><code>function App() {
    return (
      &lt;div className='App'&gt;
        &lt;TrafficLight /&gt;
      &lt;/div&gt;
    );
  }
  </code></pre>
  
  <p>I'm wrapping the App with Provider like so:</p>
  
  <pre><code>ReactDOM.render(
    &lt;Provider store={store}&gt;
      &lt;App /&gt;
    &lt;/Provider&gt;,
    document.getElementById("root")
  );
  </code></pre>
  
  <p>Any help appreciated.</p>