migrating-from-forwardref

Community

Migrate `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 ref as a regular prop, eliminating the need for the forwardRef wrapper.
  • 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.
  • useImperativeHandle Compatibility: Ensure useImperativeHandle continues to work correctly with the new pattern.
  • Use Case: Migrate a CustomInput component from using forwardRef to 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 required

Components

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.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.