How dispatch works in Reducer pattern

Cing Sian Dal
1 min readJun 11, 2020

Well, it uses two parentheses of functions, one anonymous function.

// addBlogPost
function foo(bar) {
return (a, b) => {
bar(a, b);
}
}
// dispatch
function bar(a, b) {
console.log(a, b);
}
foo(bar)(1, 2);

--

--

Cing Sian Dal

Don’t follow me. I wrote junks here. Follow me on Twitter instead.