Refactor a Promise Chain to Function Composition using Ramda

  Рет қаралды 3,469

Andy Van Slaars

Andy Van Slaars

Күн бұрын

See more RamdaJS video tutorials on egghead - vnslrs.io/ramda
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 thens you need. In this lesson, we'll look at how to take a promise chain, and reduce it down with function composition.

Пікірлер: 14
@wazazaby
@wazazaby 3 жыл бұрын
I've watched a lot of videos about Ramda, and now that I'm starting to understand the concepts I found this video very informative and it's great to finally see a real life example on how you would use Ramda to improve your code, thank you :)
@s07a08i89
@s07a08i89 7 жыл бұрын
Ramda is so sleek, I'm gonna start using it along with RxJS. Thanks for the video!
@AndrewVanSlaars
@AndrewVanSlaars 7 жыл бұрын
Ramda and RxJS go together really well! Enjoy!
@tysoncadenhead
@tysoncadenhead 7 жыл бұрын
This is a really good demonstration! I switched to using Ramda a few months ago and I still think it's awesome!
@vishalaggarwal2454
@vishalaggarwal2454 6 жыл бұрын
Short and to the point . I like this compact and to the point style of teaching...!!! THanks Andrew!!
@MereddynYT
@MereddynYT 6 жыл бұрын
use async/await to get rid of the thens ^^
@joeldpalmer
@joeldpalmer 6 жыл бұрын
Great demo
@kostas_x
@kostas_x Жыл бұрын
Can you please post the full URLs used in the examples? Thank you!
@kettlebellsporttraining1507
@kettlebellsporttraining1507 6 жыл бұрын
Really good example of some useful functional programming in Js, thank you! Anyway, when dealing with side effects (fetch, dom etc..) you should perhaps consider using monads which help in handling error cases, async operations and so on while still being compositional
@AndrewVanSlaars
@AndrewVanSlaars 6 жыл бұрын
Thanks! I agree, a Task would be more functional, but I also think there is a ton of value in introducing these concepts slowly. The second you say "monad" that turns some people off before they've had the opportunity to dip their toes in the FP water :). The power of simple compositions is a great way to get people interested and they can build up to more advanced concepts from there.
@ryanolson7
@ryanolson7 4 жыл бұрын
EPIC.
@marccawood
@marccawood 4 жыл бұрын
This style is great for the happy flow but what about error handling?
@AndrewVanSlaars
@AndrewVanSlaars 4 жыл бұрын
You can add a catch and if you want to handle errors within the compositions, Ramda has a tryCatch function that you can use - ramdajs.com/docs/#tryCatch
@Virus00000000000001
@Virus00000000000001 6 жыл бұрын
mind=blown
Introduction to RiotJS
19:36
Andy Van Slaars
Рет қаралды 25 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 102 МЛН
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 36 МЛН
Smart Sigma Kid #funny #sigma
00:33
CRAZY GREAPA
Рет қаралды 37 МЛН
Using Git Bisect
3:27
Andy Van Slaars
Рет қаралды 29 М.
RiotJS and Redux - Part 6
19:40
Andy Van Slaars
Рет қаралды 1,7 М.
RiotJS - Server Side Rendering
19:45
Andy Van Slaars
Рет қаралды 8 М.
Be more productive with git checkout --patch
6:08
Andy Van Slaars
Рет қаралды 7 М.
RiotJS and Redux - Part 3
7:50
Andy Van Slaars
Рет қаралды 2,7 М.
RiotJS and Redux - Part 1
4:59
Andy Van Slaars
Рет қаралды 7 М.
RiotJS and Redux - Part 4
17:44
Andy Van Slaars
Рет қаралды 2,5 М.
RiotJS and Redux - Part 2
7:06
Andy Van Slaars
Рет қаралды 3 М.
RiotJS and Redux - Part 5
7:15
Andy Van Slaars
Рет қаралды 1,4 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 102 МЛН