Promise chains can be a powerful way to handle a series of transformations to the results of an async call. In some cases, additional promises are required along the way. In cases where there are no new promises, function composition can reduce the number of dot chained then
s you need. In this lesson, we'll look at how to take a promise chain, and reduce it down with function composition.
composeP
can also be used.
Thinh,
It certainly can be, but the maintainers have been discussing deprecating the promise-specific versions of compose
and pipe
, This approach is less likely to go out of date with a future release of Ramda.
You can read more here if you're interested - https://github.com/ramda/ramda/pull/1869
Thanks for watching and for pointing this out for others.
in my experience it's safer to use R.path() or R.pathOr() instead of R.prop() even if there's no nesting. path() is bullet-proof against undefined values, while prop() will break