I want to better understand es6 arrow functions.
Given the following example:
    export default function applyMiddleware(...middlewares) {
      return (createStore) => (reducer, preloadedState, enhancer) => {
        // snip actual enhancer logic
        return {
            ...store,
            dispatch
        }
    }
}
Describing the above in words:
- Our exported function (applyMiddleware) takes an array parameter with spread.
- Then applyMiddleware returns a nameless function with a createStore parameter, which returns another nameless function this time with three parameters.
So without the arrows it would look like this:
export default function applyMiddleware(...middlewares) {
  return function(createStore){
      return function(reducer,preloadedState,enhancer){
        //some logic
          return{...store,dispatch}
      }
    }
}
My questions:
- Am I correct?
- What is the common use case/code paradigm we see here?
 
     
     
    