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

214
Views
Why React not understanding tag <br /> in string?

Need

const stringWithBr = 'aaaaaaa<br />bbbbbbb';

ReactDOM.render(
  <div>{stringWithBr}</div>,
  document.getElementById("root")
);
<div id="root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>

help, why this example not working? in fact i need get:

aaaaaaa
bbbbbbb
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This is a feature of React against XSS.

It provides dangerouslySetInnerHTML as an escape hatch and it's documented here.

If possible, please avoid using this, though, especially if the input can be injected by the user somehow.

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!