challenges

React Array Keys

Here’s some code that will run without error, but has an issue nonetheless. What part of this code a bad idea, and why?

Code with issue

  function TodoList({ todos }) {
    return (
      <div>
        <h1>Todos</h1>
        {todos.map(todo => (
          <Todo key={Math.random()} data={todo} />)
        )}
      </div>
    );
  }