Hacker News new | ask | show | jobs
by s_y_n_t_a_x 2546 days ago
You don't have to. The beauty of it being a simple JS function is you have flexibility.

  function FileList() {
    if (!files.length) {
      return <EmptyMessage/>;
    }
    return <List items={files} />;
  }

  function FileList() {
    return files.length
      ? <List items={files}/>
      : <EmptyMessage/>;
  }

What feels unnatural is the syntax that these templates pull out of thin air to do things the language can already do. Why should I need to learn another syntax just for templates?