Development
react18-lifecycle-patterns - Claude MCP Skill
Provides exact before/after migration patterns for the three unsafe class component lifecycle methods - componentWillMount, componentWillReceiveProps, and componentWillUpdate - targeting React 18.3.1. Use this skill whenever a class component needs its lifecycle methods migrated, when deciding between getDerivedStateFromProps vs componentDidUpdate, when adding getSnapshotBeforeUpdate, or when fixing React 18 UNSAFE_ lifecycle warnings. Always use this skill before writing any lifecycle migration code - do not guess the pattern from memory, the decision trees here prevent the most common migration mistakes.
SEO Guide: Enhance your AI agent with the react18-lifecycle-patterns tool. This Model Context Protocol (MCP) server allows Claude Desktop and other LLMs to provides exact before/after migration patterns for the three unsafe class component lifecycle method... Download and configure this skill to unlock new capabilities for your AI workflow.
Documentation
SKILL.md# React 18 Lifecycle Patterns Reference for migrating the three unsafe class component lifecycle methods to React 18.3.1 compliant patterns. ## Quick Decision Guide Before migrating any lifecycle method, identify the **semantic category** of what the method does. Wrong category = wrong migration. The table below routes you to the correct reference file. ### componentWillMount - what does it do? | What it does | Correct migration | Reference | |---|---|---| | Sets initial state (`this.setState(...)`) | Move to `constructor` | [→ componentWillMount.md](references/componentWillMount.md#case-a) | | Runs a side effect (fetch, subscription, DOM) | Move to `componentDidMount` | [→ componentWillMount.md](references/componentWillMount.md#case-b) | | Derives initial state from props | Move to `constructor` with props | [→ componentWillMount.md](references/componentWillMount.md#case-c) | ### componentWillReceiveProps - what does it do? | What it does | Correct migration | Reference | |---|---|---| | Async side effect triggered by prop change (fetch, cancel) | `componentDidUpdate` | [→ componentWillReceiveProps.md](references/componentWillReceiveProps.md#case-a) | | Pure state derivation from new props (no side effects) | `getDerivedStateFromProps` | [→ componentWillReceiveProps.md](references/componentWillReceiveProps.md#case-b) | ### componentWillUpdate - what does it do? | What it does | Correct migration | Reference | |---|---|---| | Reads the DOM before update (scroll, size, position) | `getSnapshotBeforeUpdate` | [→ componentWillUpdate.md](references/componentWillUpdate.md#case-a) | | Cancels requests / runs effects before update | `componentDidUpdate` with prev comparison | [→ componentWillUpdate.md](references/componentWillUpdate.md#case-b) | --- ## The UNSAFE_ Prefix Rule **Never use `UNSAFE_componentWillMount`, `UNSAFE_componentWillReceiveProps`, or `UNSAFE_componentWillUpdate` as a permanent fix.** Prefixing suppresses the React 18.3.1 warning but does NOT: - Fix concurrent mode safety issues - Prepare the codebase for React 19 (where these are removed, with or without the prefix) - Fix the underlying semantic problem the migration is meant to address The UNSAFE_ prefix is only appropriate as a temporary hold while scheduling the real migration sprint. Mark any UNSAFE_ prefix additions with: ```jsx // TODO: React 19 will remove this. Migrate before React 19 upgrade. // UNSAFE_ prefix added temporarily - replace with componentDidMount / getDerivedStateFromProps / etc. ``` --- ## Reference Files Read the full reference file for the lifecycle method you are migrating: - **`references/componentWillMount.md`** - 3 cases with full before/after code - **`references/componentWillReceiveProps.md`** - getDerivedStateFromProps trap warnings, full examples - **`references/componentWillUpdate.md`** - getSnapshotBeforeUpdate + componentDidUpdate pairing Read the relevant file before writing any migration code.
Signals
Information
- Repository
- github/awesome-copilot
- Author
- github
- Last Sync
- 5/10/2026
- Repo Updated
- 5/10/2026
- Created
- 4/10/2026
Reviews (0)
No reviews yet. Be the first to review this skill!
Related Skills
CLAUDE
CLAUDE.md
receiving-code-review
Use when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment
mem0-integrate
Integrate Mem0 into an existing repository using a goal-driven, TDD pipeline. Detects the repo's language automatically and asks the user to pick between Mem0 Platform (managed) and Mem0 Open Source (self-hosted). Writes failing tests before any implementation. Produces a local feature branch plus `.mem0-integration/` artifacts consumed by the paired verification skill. TRIGGER when: user says "integrate mem0", "add mem0 to this repo", "wire mem0 into <repo>", or asks how to add memory to an existing project. DO NOT TRIGGER when: the user wants general SDK usage (use skill:mem0), CLI usage (use skill:mem0-cli), or Vercel AI SDK (use skill:mem0-vercel-ai-sdk). After success, invoke skill:mem0-test-integration to verify in the same workspace (loose coupling).
Related Guides
Mastering Python and TypeScript Development with the Claude Skill Guide
Learn how to use the python typescript guide Claude skill. Complete guide with installation instructions and examples.
Building Full-Stack Applications with Claude: The Node.js MongoDB JWT Express React Skill Guide
Learn how to use the nodejs mongodb jwt express react Claude skill. Complete guide with installation instructions and examples.
Next.js SEO Dev: The Essential Claude Skill for Documented React Development
Learn how to use the nextjs seo dev Claude skill. Complete guide with installation instructions and examples.