使用array.map()渲染

我对这个问题有疑问,我们知道arr.map()总是返回一个数组,然后我们可以在代码中使用此精确地渲染元素。

class Messages extends React.Component {
  render() {
    const msgs = [
      {id: 1, text: "Greetings!"},
      {id: 2, text: "Goodbye!"},
    ];

    return (
      <ul>
        { msgs.map(m => <li>{m.text}</li>) }
      </ul>
    );
  }
}