Skip to content

Instantly share code, notes, and snippets.

@DavidVotrubec
Created May 12, 2016 07:24
Show Gist options
  • Save DavidVotrubec/acb6583f59a10335e5f6c0dccfc1a68b to your computer and use it in GitHub Desktop.
Save DavidVotrubec/acb6583f59a10335e5f6c0dccfc1a68b to your computer and use it in GitHub Desktop.
nl2br(str) {
var newStr = str.split('\n').map(function(item) {
const key = Math.random() * (9999999 - 1) + 1;
return (
<span key={key}>
{item}
<br/>
</span>
)
});
return newStr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment