What problem does it solve?
React string refs (ref="name" + this.refs.name) warn in React 18.3.1 and are removed entirely in React 19, breaking legacy class components during upgrades. This Skill provides exact before/after migration patterns so every string ref is converted correctly to React.createRef() without common mistakes.
Core Features & Use Cases
- Complete Pattern Coverage: Provides before/after code for single DOM refs, multiple refs in one component, refs in dynamic lists, callback refs, and refs passed to child components via forwardRef.
- Scan Commands: Includes grep commands to locate all ref="name" assignments and this.refs accessors so paired usages are migrated together.
- Tricky Case Handling: Documents the Map-based dynamic ref pattern for lists and warns against inline callback refs that cause ref flicker.
- Use Case: When upgrading a codebase to React 18.3.1 or React 19, use this Skill to systematically convert every string ref in class components, including the difficult refs-in-a-map case.
Quick Start
Ask the AI to migrate all string refs in your React class components to React.createRef() using this skill's patterns.