What is the way to write applyMiddleware in redux?

when learning redux middleware, I found that there are two ways to write applyMiddleware, but this is the only one in official documents
const store = createStore (reducer, preloadedState, applyMiddleware (. Middleware)

but I saw this way of writing in other places
const store = applyMiddleware (.callilewares) (createStore) (reducer, initialState)
). I would like to ask you what kind of writing this is, the old way of writing or the old way of writing it?


these two writing methods are equivalent, the source code of createStore

export default function createStore(reducer, preloadedState, enhancer) {
  if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
    enhancer = preloadedState
    preloadedState = undefined
  }

  if (typeof enhancer !== 'undefined') {
    if (typeof enhancer !== 'function') {
      throw new Error('Expected the enhancer to be a function.')
    }

    return enhancer(createStore)(reducer, preloadedState)
  }
  ...
}

the most important thing is the following line

enhancer(createStore)(reducer, preloadedState)
Menu