Skip to content

Instantly share code, notes, and snippets.

@OutThisLife
Created February 28, 2018 19:58
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 OutThisLife/69e362fabc429e898687c541db5b1ff5 to your computer and use it in GitHub Desktop.
Save OutThisLife/69e362fabc429e898687c541db5b1ff5 to your computer and use it in GitHub Desktop.
// Pretend this is in a store somewhere.
const pageData = {
title: 'My Data',
copy: 'Lorem ipsum dolar sit amet',
fields: {
testimonial: {
name: 'Bob Ross',
copy: 'Everything is amazing'
},
rating: 5
}
}
// ----
const {
title, copy,
fields: { rating, testimonial }
} = pageData
return `
<h1>${title} <em>(${rating} out of 5)</em></h1>
<p>${copy}</p>
<blockquote>
<p>${testimonial.copy}</p>
<cite>${testimonial.name}</cite>
</blockquote>
`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment