title: Using enum in ES2015
body: <p>How do I use enums in ES2015? I tried the following but I'm getting errors:</p>
  
  <p>Created a file for my enums i.e. errorTypes.js</p>
  
  <pre><code>export const Types = {
     MISSING_DATA: 0,
     INVALID_DATA: 1
  }
  </code></pre>
  
  <p>I then tried to import this into my React component and use it as follows:</p>
  
  <pre><code>import errorTypes from '../enums/errorTypes';
  
  handleOnClick(event) {
  
     // Some logic here
     const newError = {type: errorTypes.INVALID_DATA, message: "Please type carefully!"};
  
  }
  </code></pre>
  
  <p>The error I'm getting is </p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'INVALID_DATA' of undefined</p>
  </blockquote>