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

148
Vistas
Passing variable into JSX HTML Attribute

How can I pass a variable into the attribute. I am using: https://polaris.shopify.com/components/actions/button

I currently have

  const subscribeButton = (plan, text, type) => (
    <div style={{textAlign: 'center', 'paddingBottom': 15}}>
      <Button
        onClick={() => processSubscription(plan.stripe_price_id)}
        key={plan.stripe_plan_id}
       -> Need to insert "type" here <-
      >
        <p>{text}</p>
      </Button>
    </div>
  )

In my render, I have a few of these

subscribeButton(plan, 'Cancel', 'destructive')

I need pass the type of button, "primary", "destructive" and a few more options. I pass that in with the 3rd param. The issue is, this is a dynamic field such as

<Button primary></Button> and <Button destructive>.

How would I go about passing this in via a variable?

about 4 years ago · Juan Pablo Isaza
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