migrating-from-forwardref
CommunityMigrate `forwardRef` to React 19's ref-as-prop pattern.
Authordjankies
Version1.0.0
Installs0
System Documentation
What problem does it solve?
The forwardRef API is deprecated in React 19, requiring migration to a new, simpler ref-as-prop pattern. This Skill guides you through updating your components and TypeScript types to the modern approach.
Core Features & Use Cases
- Simpler API: Learn to pass
refas a regular prop, eliminating the need for theforwardRefwrapper. - Better TypeScript: Understand how to correctly type components that accept refs in React 19, improving type inference.
- Less Boilerplate: Reduce code by removing unnecessary imports and wrapper functions.
useImperativeHandleCompatibility: EnsureuseImperativeHandlecontinues to work correctly with the new pattern.- Use Case: Migrate a
CustomInputcomponent from usingforwardRefto the new ref-as-prop pattern, ensuring its ref functionality (e.g.,focus(),clear()) remains intact and types are updated.
Quick Start
Refactor the Button component in src/components/Button.js to remove forwardRef and accept ref as a regular prop.
Dependency Matrix
Required Modules
None requiredComponents
references
💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: migrating-from-forwardref Download link: https://github.com/djankies/claude-configs/archive/main.zip#migrating-from-forwardref Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.