What problem does it solve?
React 18 deprecates componentWillMount, componentWillReceiveProps, and componentWillUpdate, and guessing the wrong replacement pattern causes concurrent-mode bugs, stale DOM reads, and React 19 breakage. This Skill provides exact before/after migration patterns with decision trees so you never pick the wrong replacement.
Core Features & Use Cases
- Decision Trees for Each Lifecycle Method: Route componentWillMount, componentWillReceiveProps, and componentWillUpdate logic to the correct replacement (constructor, componentDidMount, componentDidUpdate, getDerivedStateFromProps, or getSnapshotBeforeUpdate) based on what the code actually does.
- Full Before/After Code References: Three reference files cover state initialization, side effects, prop-driven derivation, DOM snapshot reads, and request cancellation with complete code examples.
- getDerivedStateFromProps Trap Warnings: Documents the every-render firing behavior, static method constraints, and purity requirements that cause the most common migration mistakes.
- Use Case: When upgrading a legacy class component that fetches data in componentWillReceiveProps, the Skill directs you to componentDidUpdate with prevProps comparison and a request-ID cancellation pattern.
Quick Start
Ask the AI to migrate the unsafe lifecycle methods in your class component to React 18 compliant patterns using this skill.