title: Array as Javascript Const?
body: <p>Trying to understand a React-Redux codebase which uses a custom middleware in the store. The custom middleware consumes an API Client function which manages making calls to API for the actions passed to it.</p>
  
  <p>In the middleware, there is a variable declaration which I cannot understand. It uses an array as the variable. </p>
  
  <pre><code>const [REQUEST, SUCCESS, FAILURE] = types; 
  // types: [REGISTER, REGISTER_SUCCESS, REGISTER_FAIL],
  </code></pre>
  
  <p>The reducer looks like this:</p>
  
  <pre><code>case LOAD:
    return {
      ...state,
      loading: true
    };
  case LOAD_SUCCESS:
    saveAuthCookie( action.result );
    return {
      ...state,
      loading: false,
      loaded: true,
      user: cookie.load( userCookieName ) ? cookie.load( userCookieName ) : action.result
    };
  case LOAD_FAIL:
    console.log(`auth LOAD_FAIL with error ${util.inspect(action.error)}`);
    return {
      ...state,
      loading: false,
      loaded: false,
      error: action.error
    };
  </code></pre>
  
  <p>And the function exported by the reducer that is being called looks like this:</p>
  
  <pre><code>export function load() {
   return {
     types: [LOAD, LOAD_SUCCESS, LOAD_FAIL],
     promise: (client) =&gt; client.get( '/auth/loadAuth' )
   };
  }
  </code></pre>