Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

151
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda