Hope I can help with this explanation.
allows you to see what you are familiar with:
return Promise.resolve(action) .then(function (action) { store.dispatch(action)} )
You see this part:
function (action) { store.dispatch(action)}
This is just a function waiting for the action property to be passed.
Now, when we look at the fact that you are having problems related to your brain, here's what:
return Promise.resolve(action) .then(store.dispatch) // <--- this part
"submit" is just a function, in which case an argument is expected. Most likely, the object is like this:
store.dispatch({ type: 'MY_ACTION_TYPE' })}
now you can βwrapβ it in closure, like this, and it will look familiar:
.then( (action) => { store.dispatch(action) })
but do we really need to βwrapβ it with an anonymous function? In fact, we can just put: store.dispatch, and this is a wait function to pass an argument from the return of the promise. think of it this way:
var MultiplyByTwo = (x) => x * 2 Promise.resolve(5).then(MultiplyByTwo)
when we look at the "MultipleByTwo" function - you have a familiar signature that you know about: (x) => x * 2
If we just delete the function name, then the same thing:
Promise.resolve(5).then((x) => x * 2)
Note. You see that the solution (5) β thinks about this solution. Then as a chain or βhandoverβ. When we βsolve (5),β we pass this value β5β forward to β. Then.β Now remember that the value 5 can be any ... primitive, 5 in this case, the {TYPE: "WHATEVER"} object, function, etc. It just comes off. For example, "Hey, here is my value ...."
resolve(5).then(myfunction) | ^ |__>__>__>__>__>_|
It is important to understand that "myFunction" is the example above, either in our example multiplyByTwo or even in the store.dispatch example. they ALL expect passing arguments.
multiplyByTwo(x) <-- expecting one argument
or your function may not declare it inside the function signature, but it will be inside the body, ala ..
myFunction() { const args = Array.from(arguments)
or hoping for any number of arguments
myOtherFunction(...args)
But yes - these functions are expected when any input from the permission will act. There may be times when you don't care about the return value, if there is one, you just want to have some flow control ... do it, "THEN", that ..
I hope this was helpful, and I hope that I really answered your question. If not, let me know.