Render a list with JavaScript tagged templates and Ramda

In notebook:
Work Notes
Created at:
2019-01-08
Updated:
2019-01-08
Tags:

Using Ramda reduce and an accumulator function.

(The naive approach would be just to map over the list. Sometimes it does work, but meaning of map is to apply a transformation to each item in the list and is not really meant to output a single string item)

  const presentTagsStructure = (acc, tag) => `${acc}
<dt>${tag.name}</dt>
`

const createArticle = pageObj => `
  <dl>
    ${R.compose(
      R.reduce(R.curry(presentTagsStructure), ''),
      R.prop('tags')
    )(pageObj)}
  </dl>
`