Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

144
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda