title: How is redux thunk with extra argument working?
body: <p>this is the source code of redux-thunk library:</p>
  
  <pre><code>function createThunkMiddleware(extraArgument) {
    return ({ dispatch, getState }) =&gt; next =&gt; action =&gt; {
      if (typeof action === 'function') {
        return action(dispatch, getState, extraArgument);
      }
  
      return next(action);
    };
  }
  
  const thunk = createThunkMiddleware();
  thunk.withExtraArgument = createThunkMiddleware;
  
  export default thunk;
  </code></pre>
  
  <p>I can not understand how "thunk" and "thunk.withExtraArguent" are different from each other. </p>
  
  <p><code>const thunk=createThunkMiddleware()</code> // this is the middleware that we use for our async requests</p>
  
  <p>However thunk.withExtraArgument is the SAME createThunkMiddleware function but this time it is just being passed as a reference. We are able to pass an argument  here but we cannot pass the argument to the <strong>thunk</strong>. </p>
  
  <p>Can someone explain the difference please? To me <strong>thunk</strong> and <strong>thunk.withExtraArgument</strong> are same</p>