Skip to content

Instantly share code, notes, and snippets.

@dance2die
Created August 10, 2018 02:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dance2die/c861dc490bd4eec2e28fdb098ea0a3a7 to your computer and use it in GitHub Desktop.
Save dance2die/c861dc490bd4eec2e28fdb098ea0a3a7 to your computer and use it in GitHub Desktop.
function createMarkup(html) {
return { __html: html };
}
const RedditPost = ({
post: { title, selftext, id, url, thumbnail },
order
}) => (
<div className="redditPost">
<p className="postTitle">
<a href={url} target="_blank">
#{order} {title}
</a>
</p>
<div
className="redditText"
dangerouslySetInnerHTML={createMarkup(selftext)}
/>
</div>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment