使用数组索引

如果你手头没有唯一的数据库 ID,你还可以使用数组的数字索引,如下所示:

render() {
  const { todos } = this.props;
  return (
    <ul>
      { todos.map((todo, index) =>
        <li key={ `todo-${index}` }>
          { todo.text }
        </li>
      }
    </ul>
  );
}