September 2018
Intermediate to advanced
302 pages
7h 17m
English
One of the most advertised features of HOCs is their composability. Taking, for instance, the withLogger, withAnalytics, and withRouter HOCs, we can compose them in the following fashion:
withLogger(withAnalytics(withRouter(SomeComponent)))
The Ramda library takes composability to the next level. Unfortunately, I find many developers hardly understand it. Let's look at an equivalent example:
R.compose(withLogger,withAnalytics, withRouter)(SomeComponent)
What most people find hard about Ramda compose is understanding how it works. It generally applies functions from right to left, meaning that it first evaluates withRouter and then forwards results to withAnalytics, and so on. The most important thing about the functions ...
Read now
Unlock full access