react-modernization

Migrate React class components to functional components with hooks.

5|Updated Aug 23, 2025
One-click install
npx skills add https://github.com/camoneart/claude-code --skill react-modernization
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-modernization
Source: https://github.com/camoneart/claude-code/tree/main/skills/react-modernization
Command: npx skills add https://github.com/camoneart/claude-code --skill react-modernization

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires jscodeshift, and includes assets (resource) and references (resource) components.

What problem does it solve?

Keeping React applications up-to-date with the latest versions and best practices (like Hooks and concurrent features) can be a complex and time-consuming process. This Skill provides a comprehensive guide to upgrading, migrating class components to hooks, and automating refactoring with codemods.

Core Features & Use Cases

  • Version Upgrades: Guides through breaking changes and new features from React 16 to 18.
  • Class to Hooks Migration: Provides patterns for converting state, lifecycle methods, context, and HOCs to functional components with hooks.
  • Concurrent Features Adoption: Explains how to use React 18's new root API, automatic batching, transitions, and Suspense.
  • Use Case: If you have a legacy React application built with class components, this Skill helps you systematically migrate it to modern functional components with hooks, improving readability, maintainability, and leveraging the latest performance features.

Quick Start

Example: Convert a class component to a functional component with hooks

This demonstrates converting a simple class-based counter to a functional one.

function Counter() { const [count, setCount] = useState(0); const increment = () => { setCount(count + 1); }; return ( <div> <p>Count: {count}</p> <button onClick={increment}>Increment</button> </div> ); }

Frequently Asked Questions about react-modernization

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

FAQPage Schema
How do I migrate React class components to hooks?

Migrating class components to hooks involves converting state and lifecycle methods to useState and useEffect hooks. This Skill provides patterns for converting state management, lifecycle logic, context, and higher-order components into functional components with hooks, improving readability and enabling modern React features.

What are React 18 concurrent features and how do I use them?

React 18 concurrent features include the new root API, automatic batching, transitions, and Suspense. This Skill explains how to adopt these features to improve performance and user experience in your application during modernization.

Can I automate React refactoring with codemods?

Yes, codemods automate large-scale refactoring by transforming code patterns programmatically. This Skill uses jscodeshift to apply automated codemods for converting class components to hooks and modernizing your React codebase at scale.

How do I upgrade a React app from older versions to React 18?

Upgrading React involves understanding breaking changes between versions and applying migrations systematically. This Skill guides you through version upgrades from React 16 to 18, including dependency updates and code pattern changes required for each version.

Should I convert my entire codebase to TypeScript during React modernization?

TypeScript adoption is optional but recommended during modernization for type safety and maintainability. This Skill covers TypeScript updates as part of a comprehensive modernization strategy, helping you decide when and how to integrate it with your hooks migration.