Top Skilled Course Forum

Explore daily practice discussions about your courses.

MERN Full Stack · React

Why does React need a key for each item in a list?

  1. Student 1

    Why does React need a key for each item in a list?

  2. Faculty

    A stable key lets React match an item with its previous render when the list changes. Use a record ID when one is available.

  3. Student 2

    Can I use the array index for a list of forum replies?

  4. Faculty

    Use each reply's ID. Replies may be inserted, removed, or reordered, and array indexes would then refer to different replies.