JSFiddle - React, Tailwind, and code Playground
HTML
<div id="foo">One<br/>two</div>
JavaScript
$('br').replaceWith("\n");
alert($('#foo').text());
<div id="foo">One<br/>two</div>
$('br').replaceWith("\n");
alert($('#foo').text());