Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

Why should array index not be used as a React key in a reorderable list?

  1. A Indexes are too long
  2. B The key must remain stable per item, or component state attaches to the wrong element after reordering
  3. C Indexes are not unique
  4. D React does not accept numbers as keys
Answer

The key must remain stable per item, or component state attaches to the wrong element after reordering

Keys let the reconciler match elements across renders. When items reorder, index-based keys cause state and DOM nodes to be reused incorrectly.

All Front end Development MCQs

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as