title: In React, what is the best way to define action types?
body: <p>In React, which one of the following ways is the best way to define action types?</p>
  
  <p>First way:</p>
  
  <blockquote>
    <p>Defining actions using strings like the following:</p>
  </blockquote>
  
  <pre><code>const actionCreatorExample = (value) =&gt; {
    return { type: 'SET_RESPONSE', value };
  }
  </code></pre>
  
  <p>Second way:</p>
  
  <blockquote>
    <p>Defining action types in an object and referring to action types by accessing the values of that object. Like this:</p>
  </blockquote>
  
  <pre><code>export const actionTypes = {
    SET_RESPONSE: 'SET_RESPONSE'
  };
  
  import actionTypes from './actionTypes';
  
  const actionCreatorExample = (value) =&gt; {
    return { type: actionTypes.SET_RESPONSE, value };
  }
  </code></pre>
  
  <p>The second way looks neat but why waste memory by storing the <code>actionTypes</code> object? Any thoughts?</p>