Created
May 12, 2016 07:24
-
-
Save DavidVotrubec/acb6583f59a10335e5f6c0dccfc1a68b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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