The Best Agent Prompt Is a Lint Error

typescript dev.to

Every LLM writes key={index} on list items. It's in millions of React tutorials as the quick fix — React wants a key, here is a key. The code compiles. It renders. When the list reorders or an item is removed from the middle, React reuses the wrong DOM nodes: state stays pinned to the old position, controlled inputs keep stale values, transitions fire on the wrong elements. A lint rule fixes this. react/no-array-index-key fires: "Do not use Array index in keys — use a stable identifier." The ag

Read Full Tutorial open_in_new
arrow_back Back to Tutorials