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

358
Vistas
How to replace space with   in a string (ReactJS) and render in HTML?
<div className="mt-2 font-sidebar capitalize">
  {item.title}
</div>

item.title can be any string (from backend) for example "all products", "most liked", "featured items", etc.

I want a way to replace the space in item.title with &nbsp; so that when rendered in HTML it still has a space - This is for a specific use case.

I would really appreciate your help.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can do like this:

{item.title.replaceAll(' ', '\u00a0')};

you can use replace() if you are sure there is only 1 space, so i suggest to use replaceAll()

Instead of using the &nbsp; you can use the Unicode character which &nbsp; refers to (U+00A0):

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