title: where is dispatch coming from in this line? export const setAlert = (msg, alertType,timeout=5000) =>dispatch =>
body: <p>I came across this code. He/she Is creating an action for redux in react-redux app. I don't understand where dispatch is coming from . Can you explain please also is this a good practice?
  <pre></p>
  
  <code>import uuid from 'uuid';
  import {SET_ALERT,REMOVE_ALERT} from './types';
  export const setAlert = (msg, alertType,timeout=5000) =&gt;dispatch =&gt;{
      const id = uuid.v4();
      dispatch ({
          type:SET_ALERT,
          payload:{msg,
              alertType,
              id}
      }); 
  
      setTimeout(()=&gt;dispatch({type:REMOVE_ALERT,payload:id}),timeout)}
  </code></pre>
  
  <p></p>