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

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

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 Denunciar

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 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