title: What's the purpose of the 3rd argument in useReducer?
body: <p>From the <a href="https://reactjs.org/docs/hooks-reference.html#lazy-initialization" rel="noreferrer">docs</a>:</p>
  
  <blockquote>
    <p>[init, the 3d argument] lets you extract the logic for calculating the initial state outside the reducer. This is also handy for resetting the state later in response to an action.</p>
  </blockquote>
  
  <p>And the code:</p>
  
  <pre class="lang-js prettyprint-override"><code>function init(initialCount) {
    return { count: initialCount };
  }
  
  function reducer(state, action) {
    switch (action.type) {
      ...
      case 'reset':
        return init(action.payload);
      ...
    }
  }
  
  function Counter({initialCount}) {
    const [state, dispatch] = useReducer(reducer, initialCount, init);
    ...
  }
  </code></pre>
  
  <p>Why would I do that over reusing a constant <code>initialState</code>?</p>
  
  <pre class="lang-js prettyprint-override"><code>const initialState = {
    count: 5,
  };
  
  function reducer(state, action) {
    switch (action.type) {
      ...
      case 'reset':
        return initialState;
      ...
    }
  }
  
  function Counter({initialCount}) {
    const [state, dispatch] = useReducer(reducer, initialState);
    ...
  }
  </code></pre>
  
  <p>Looks less verbose to me.</p>