I do understand Redux a bit, but I don't understand how you can put a function inside a function.
import api from '../utils/api';
import {
  GET_PROFILE, PROFILE_ERROR
} from './types';
export const getCurrentProfile = () => async (dispatch) => {
  try {
    const res = await api.get('/profile/me');
    dispatch({
      type: GET_PROFILE,
      payload: res.data
    });
  } catch (err) {
    dispatch({
      type: PROFILE_ERROR,
      payload: { msg: err.response.statusText, status: err.response.status }
    });
  }
};
I am having issues with this line:
export const getCurrentProfile = () => **async (dispatch) => {}**
- Are we defining our own function here with async (dispatch) => {}?
- Why will we define our own function?
- I know what dispatchdoes, but where do we get it and why are we using it on the two objects?
- What is the name of this pattern, if any?
 
     
    