DEV Community

loading...

Discussion on: My React stack for 2019

Collapse
marklai1998 profile image
Mark Lai

Have you tried Ramda over Lodash?
curry everything is so awesome, and everything is compossible

Lodash

const myFn = (input)=>{
  const multiply = _.multiply(input, 2)
  const add = _.add(multiply, 1)
  const add = _.add(multiply, 1)
  return add < 0 ? add * -1 : add
}

myFn(-4) //=> 7

Ramda

const myFn = R.compose(Math.abs, R.add(1), R.multiply(2))

myFn(-4) //=> 7

Another Example
Lodash

const myFn = (list)=> _.map(list, (n) => n * 2)

myFn([4,8]) //=> [8, 32]

Ramda

const myFn = R.map(R.multiply(2))

myFn([4,8]) //=> [8, 32]
Collapse
pajasevi profile image
Pavel Ševčík Author

I was recently looking into more functional paradigm and Ramda seems great. Hopefully I will have a chance to use it soon.

Collapse
anduser96 profile image
Andrei Gatej

I’d also recommend trying rxjs! It’s simply awesome!