Check out a free preview of the full Functional-Light JavaScript, v3 course
The "Ramda" Lesson is part of the full, Functional-Light JavaScript, v3 course featured in this preview video. Here's what you'd learn in this lesson:
Kyle recommends the Ramda functional library for students who do not yet have a functional library preference and then gives an example of using the Ramda library.
Transcript from the "Ramda" Lesson
[00:00:00]
>> Kyle Simpson: The next library I wanna talk about is called Ramda, and this is definitely where my recommendation would be. If you don't already have a library that you've been working with and you're looking for a place to start, I would unreservedly recommend starting with Ramda. It is definitely one of the most popular of the functional libraries out there.
[00:00:20]
And I understand that when I call out 2 libraries there are like 400 others where people are saying, why didn't you pick my favorite one? There's nothing wrong with any of those 400 functional libraries. If they behave by the functional rules, then they're great and whichever one you pick is fine.
[00:00:36]
But I just wanna give you some places to start. There are large communities, they're mature, there's lots of documentation, these things have been around a long time. And importantly, they've been highly optimized, because they're in use by so many places. So there's benefits to using the big players if you will, at least starting with those.
[00:00:54]
So I would say start with Ramda, unless you've already worked with Lodash and then lodash/fp. This is ramdajs.com, that's where you can link to. They have a REPL, it's an online thing where you can play around with their code, and then all of the documentation. So they got a really great set of resources for you.
[00:01:14]
>> Kyle Simpson: Same example as I showed on the previous screen, but now it's using Ramda. So know we see R., instead of fp., from Lodash. We see R.reduce, and then we see R.curryN, R.compose, R.inc, and so forth. There's a little quirky difference between lodash/fp and Ramda. And you'll find these sorts of things the more you look at these libraries.
[00:01:38]
Ramda provides us a function called inc, for doing increment. lodash doesn't provide us one, but it did provide us a curried add, which is why we did add of 1 to make our increment function, okay? So there will be those sorts of tweaks that you have to do as you're adapting from one library to another.
[00:01:56]
Definitely play around with these and check through the documentation, try it on some of your code, to get a feeling for the different ebbs and flows that are provided to you.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops