Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

362
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!