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

209
Visualizações
How to insert a complex div inside a string in ReactJs?

I am working on a ReactJs and I have to style a div inside a string

Here is the string I am talking about

const instruction1 = <div>XXXXXX: xxxx <div>{state.numbers[0]}</div>, xxxxxx xxxxxxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxxxxxxx xxxxxxxxxxx xxxxxx xxxxxxxxxx</div>

But the outcome is something like this enter image description here

But I need the outcome to be like this

enter image description here

The problem is that I have to use a div because there will be multiple elements inside that div.

Why is using the div tag mess up the design?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

div is a block element, it means in the HTML it will look like in a new row. Try to use span instead. It will not break the line.

Update: not sure why you need div at all. It seems you could put your items directly to the root div:

<div>XXXXXX: xxxx {state.numbers[0]}, {state.numbers[1]}, xxxxxx xxxxxxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxxxxxxx xxxxxxxxxxx xxxxxx xxxxxxxxxx</div>
about 4 years ago · Juan Pablo Isaza Relatório

0

In order to fix this, I wrapped the div in a span and gave display inline-block to that span

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