Skip to content

Instantly share code, notes, and snippets.

@tobob
Created December 30, 2020 11:06
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 tobob/92af7ec99f7d0791e9c3892df743ca4f to your computer and use it in GitHub Desktop.
Save tobob/92af7ec99f7d0791e9c3892df743ca4f to your computer and use it in GitHub Desktop.
const content = () => {
if(post.contentReferences) {
return(post.contentReferences.map(reference => {
switch(reference.__typename) {
case 'ContentfulCodeComponent': {
return <CodeComponent {...reference} />
}
default:
return null
}
}))
}
return (
<div
dangerouslySetInnerHTML={{
__html: post.body.childMarkdownRemark.html,
}}
/>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment