Comment

Comment by andix

Most template languages can't do something like that:

  // data
  const numbered = true // or false
  const strings = ["a", "b", "c"]

  // render
  const items = strings.map(i => <li key={i}>Item {i}</li>)

  if (numbered)
    return (<ol>{items}</ol>)
  else
    return (<ul>{items}</ul>)
parent andix 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton