Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

143
Views
Save a variable and use it in later stage in Ramda compose

I am very new to Ramda and have got stuck in a problem. I need to get response from an api and pass it to next function but that same response needs to be used again at a later stage in the same compose. How can I save its value in that ramda func scope so it can be re-used again?

const getData = (req, ctx) => R.compose
        (
          R.andThen(... do some action using response from callSomeApi_2 and prop2)
        , callSomeApi_2(req, ctx)
        , R.andThen(R.map(R.prop('prop1'))) // response has prop1 and prop2 where prop2 is needed after getting response from callSomeApi_2
        , callSomeApi_1(req, ctx)
        );

How can this be achieved?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Have you tried to use R.props() instead of R.prop() so the code becomes something like that :

const getData = (req, ctx) => R.compose
    (
      R.andThen(... do some action using response from callSomeApi_2 and prop2)
    , callSomeApi_2(req, ctx)
    , R.andThen(R.map(R.props('prop1', 'prop2'))) // this will include both properties 1 & 2
    , callSomeApi_1(req, ctx)
    );
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!