Last active
November 4, 2018 15:45
-
-
Save productioncoder/a388a9b34d4176113385f7c1428092f1 to your computer and use it in GitHub Desktop.
Youtube in React: properly formatting video description
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
import Linkify from 'react-linkify'; | |
getDescriptionParagraphs() { | |
const videoDescription = this.props.video.snippet ? this.props.video.snippet.description : null; | |
if (!videoDescription) { | |
return null; | |
} | |
return videoDescription.split('\n').map((paragraph, index) => <p key={index}><Linkify>{paragraph}</Linkify></p>); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment