
React18 Lifecycle Patterns
If you're still maintaining React class components and hitting UNSAFE_ warnings in 18.3.1, this gives you exact migration patterns for the three deprecated lifecycle methods. The decision tables are the real value here: they route you to the right replacement based on what the code actually does, not just which method name you're replacing. componentWillReceiveProps doing a fetch goes to componentDidUpdate, pure state derivation goes to getDerivedStateFromProps, and the guide is explicit about which is which. Saves you from the classic mistake of reaching for getDerivedStateFromProps when you actually need componentDidUpdate with a prev prop comparison. The references include full before and after code blocks for each case.
- skills.sh installs
- 745
- GitHub stars
- 41K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add github/awesome-copilot --skill react18-lifecycle-patterns --agent claude-codeInstalls into .claude/skills of the current project.
Files
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 |
| Runs a side effect (fetch, subscription, DOM) | Move to componentDidMount | → componentWillMount.md |
| Derives initial state from props | Move to constructor with props | → componentWillMount.md |
componentWillReceiveProps - what does it do?
Sponsors
Details
- Repository
- github.com/github/awesome-copilot
- Categories
- Frontend Development, Git & Pull Requests, Documentation, AI & Agent Building, Productivity & Planning, Rust
- First seen
- May 16, 2026
More from github/awesome-copilot
All 318- React18 String Refs743
- React18 Enzyme To Rtl742
- Code Tour739
- Linkedin Post Formatter361
- Ui Screenshots212
- Data Breach Blast Radius110
- Sql Server Table Reconciliation104
- Aws Cloudwatch Investigation
- Aws Cost Optimize
- Aws Resource Health Diagnose
- Aws Well Architected Review
- Azure Well Architected Review
- Bug Reproduction Brief
- Incident Postmortem
- Mcp Implementation Security Review
- Pester Migration
- Tm7 Threat Model
- Git Commit48.4K
- Excalidraw Diagram Generator34.4K
- Multi Stage Dockerfile31.5K
- Documentation Writer28.4K
- Prd24.4K
- Refactor22.6K
- Java Springboot21.8K