Here are some ajax calls returns <br />
in their data, while I found it was hard to handle.
Here is what I got for now, but not working at all. The string was split correctly, while react gave me several <span></span>
tags without proper <br />
line breaks.
const breakLine = text => {
const regex = /<br\s*[\/]?>/gi
return text.split(regex).map(
line => line.match(regex) ? React.createElement('br') : line
)
}
const Text = ({ content }) => <p>
{ breakLine(content) }
<p>
// Usage
<Text content="Here are some <br /> Lines <br> to break!" />