title: redux dispatch not work when use in axios interceptors
body: <p>I want to show snackbar when axios return error.
  I use redux for config snackbar.</p>
  
  <pre><code>axiosAgent.interceptors.response.use(
    function(response) {
      return response;
    },
    function(error) {
      console.log('object')
      const dispatch = useDispatch();
      dispatch({
        type: ActionsTypes.CHANGE_SNACKBAR_CONFIG,
        payload: { variant: "error", message: Strings.errors.problem }
      });
      dispatch({ type: ActionsTypes.CHANGE_SNACKBAR_SHOW, payload: true });
      return Promise.reject(error);
    }
  );
  </code></pre>
  
  <p>and here is my snackbar component:</p>
  
  <pre><code>export default function Snackbar() {
    const open = useSelector(state =&gt; state.Snackbar.showSnackbar);
    const config = useSelector(state =&gt; state.Snackbar.snackbarConfig);
    const dispatch = useDispatch();
  
    const handleClose = (event, reason) =&gt; {
      if (reason === "clickaway") {
        return;
      }
      dispatch({ type: ActionsTypes.CHANGE_SNACKBAR_SHOW, payload: false });
    };
    useEffect(() =&gt; {
      console.log(config);
    }, [config]);
    return (
      &lt;SB open={open} autoHideDuration={6000} onClose={handleClose}&gt;
        &lt;Alert onClose={handleClose} severity={config.variant}&gt;
          {config.message}
        &lt;/Alert&gt;
      &lt;/SB&gt;
    );
  }
  </code></pre>
  
  <p>but doesn't work.
  When I dispatch it from component it works but here not works.</p>