react-key-prop

Enforce stable, unique data-sourced keys for React list rendering.

Updated Apr 29, 2026
One-click install
npx skills add https://github.com/dev-khoi/conHack-2026 --skill react-key-prop-dev-khoi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-key-prop
Source: https://github.com/dev-khoi/conHack-2026/tree/main/.opencode/skills/react-key-prop
Command: npx skills add https://github.com/dev-khoi/conHack-2026 --skill react-key-prop-dev-khoi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The skill helps developers implement reliable, stable rendering of list items in React by enforcing proper key usage to avoid UI glitches and performance issues.

Core Features & Use Cases

  • Enforces the rule of using unique, stable keys sourced from data to prevent reordering bugs.
  • Demonstrates when using indices as keys is acceptable and when it isn't, with practical examples.
  • Provides guidelines for generating IDs and avoiding anti-patterns in common list rendering scenarios.

Quick Start

Render a list using stable, unique keys from your data to ensure predictable React reconciliation.

Frequently Asked Questions about react-key-prop

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does React require stable keys for list rendering?

Using array indices as React keys causes rendering bugs during item reordering or dynamic insertion because React misidentifies elements, leading to corrupted component state. Stable, data-sourced keys prevent these reconciliation failures and maintain UI correctness.

How do I generate unique keys for React lists without IDs?

Generate unique keys for React lists lacking IDs by creating stable identifiers before rendering, ensuring each item receives a persistent key across re-renders. Avoid using array indices as substitutes to prevent anti-patterns and maintain reconciliation performance.

When is it acceptable to use index as a key in React lists?

Using index as a key in React lists is acceptable only for static, non-reorderable lists where items are never dynamically inserted or removed. For dynamic data or conditional rendering, stable data-sourced keys are required to avoid anti-patterns and UI glitches.

What causes React list reordering bugs with dynamic data?

React list reordering bugs with dynamic data occur when keys are unstable or index-based, causing React's reconciliation algorithm to mismatch components and state. Enforcing stable, unique keys sourced from underlying data resolves these rendering glitches.

Does conditional rendering in React affect list key selection?

Conditional rendering in React affects list key selection by requiring stable, unique keys to track elements appearing and disappearing across renders. Data-sourced keys ensure correct component identification, whereas index-based keys introduce anti-patterns and break UI performance.