One More Real Life Example

Sat, 09 Oct 2021 11:14:39 +0100

One more real-life example where you see currying would be when you connect your redux store to your Component in React. The syntax of that looks something like this:-

export default connect(mapStateToProps, mapDispatchToProps)('SomeComponentName');

Here we first call the connect function and it returns another function

which is called using the second braces`()`.

Basically, Currying is a transformation of functions that translates a

function from callable as f(a, b, c) into callable as f(a)(b)(c).

This can also be helpful when we need to delay some execution of the whole

function but want to calculate intermediate results.