0Pricing
React Academy · Lesson

Key & Ref Best Practices

Use stable keys, avoid index-as-key pitfalls, and work with callback refs.

Welcome

In this lesson you will learn how to use list keys correctly, why using array index as a key causes bugs, and how to work with callback refs and forwarded refs.

Why Keys Matter

React uses `key` props to track which items in a list changed, were added, or were removed between renders. A correct key lets React reuse existing DOM nodes; a wrong key causes unnecessary unmounts and remounts.

All lessons in this course

  1. What StrictMode Does
  2. Pure Components & Avoiding Side Effects in Render
  3. Key & Ref Best Practices
  4. Folder Structure & Naming Conventions
← Back to React Academy