title: redux initial state as first parameter is a bad practice
body: <p>In redux the initial state is provided by using a default parameter for the first argument <code>state</code>, while the second argument <code>action</code> does not have a default. However, I consider this a code smell  (and so do others such as <a href="https://github.com/airbnb/javascript#functions--defaults-last" rel="nofollow noreferrer">Airbnb guidelines</a>) since you always need to provide the first argument (and then would use <code>undefined</code> to get the default which is cumbersome). I totally understand why you would want to provide that initial state, but why do they not switch the arguments so the default is 2nd to bring code in compliance with common guidelines? </p>
  
  <pre><code>// bad
  function someReducer(state = 0, action) {
    switch (action.type) {
    default: return state;
  }
  
  // good
  function someReducer(action, state = 0) {
    switch (action.type) {
    default: return state;
  }
  </code></pre>
  
  <p>redux forces our developers to use a bad practice which encourages them to do it in other places. Why would redux-developers still decide for such architecture?</p>
  
  <p><strong><em>UPDATE</em></strong></p>
  
  <p>The reason, why it is a <em>bad</em> practice to have defaults going first comes from language design itself. In JS the interpreter cannot tell what the intention of the developer was. As an example:</p>
  
  <pre><code>const giveMe = (goodHuman = true, candy) =&gt; (goodHuman &amp;&amp; candy) ? 'candy' : 'tea';
  </code></pre>
  
  <p>So, will I get candy?</p>
  
  <pre><code>giveMe(true) // not clear! (but it is 'tea')
  </code></pre>
  
  <p>I cannot access the candy with a single parameter! But I guess the developer would have liked me to get some, right? However, <code>candy</code> is always <code>undefined</code> making the conditional expression evaluate to <code>undefined</code>. As a fallback the else-part is executed. It is not a clear intention and hard to guess what the developer wanted to express. Such code would not come through our review-process / QA.</p>
  
  <p>So, in the following example, the developer made sure that we can access that candy if we want it and he beliefs that we by default are good humans who should get that candy.:</p>
  
  <pre><code>candy giveMe = (candy, goodHuman = true) =&gt; (goodHuman &amp;&amp; candy) ? 'candy' : 'tea';
  giveMe(true) // finally we get the candy!
  </code></pre>
  
  <p>Since people say that putting the default in front is a <em>best</em> practice with redux, I would consequently argue that redux has a bad design on the reducers' signature! It might origin from the fact that reducer-functions in general have a similar signature, but <strong>they do not make the first argument optional</strong> which would not make any sense! It argue that it is a bad design decision of redux to make it a "best practice" calling a function using <code>undefined</code>.</p>