
React18 String Refs
github/awesome-copilotOfficial
Migration guide for React string refs to React.createRef() in class components, covering React 18.3.1 and React 19.
- skills.sh installs
- 744
- GitHub stars
- 41.4K
- last updated
- Aug 21, 2026
What it does
- Covers single refs, multiple refs, list and dynamic refs, callback refs, and refs forwarded to child components
- Includes grep scans for
ref="andthis.refs.insrc/and a per-case before/after reference inreferences/patterns.md - Enforces a three-step rewrite: add a
React.createRef()class field, switch JSX toref={this.name}, and replacethis.refs.namewiththis.name.current - Designed for teams preparing class components for React 19, where string refs are removed
Install
$ npx -y skills add github/awesome-copilot --skill react18-string-refs -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
React 18 String Refs Migration
String refs (ref="myInput" + this.refs.myInput) were deprecated in React 16.3, warn in React 18.3.1, and are removed in React 19.
Quick Pattern Map
| Pattern | Reference |
|---|---|
| Single ref on a DOM element | → patterns.md#single-ref |
| Multiple refs in one component | → patterns.md#multiple-refs |
| Refs in a list / dynamic refs | → patterns.md#list-refs |
| Callback refs (alternative approach) | → patterns.md#callback-refs |
| Ref passed to a child component | → patterns.md#forwarded-refs |
Scan Command
# Find all string ref assignments in JSX
grep -rn 'ref="' src/ --include="*.js" --include="*.jsx" | grep -v "\.test\."
# Find all this.refs accessors
grep -rn "this\.refs\." src/ --include="*.js" --include="*.jsx" | grep -v "\.test\."
Both should be migrated together - find the ref="name" and the this.refs.name accesses for each component as a pair.
The Migration Rule
Details
- Repository
- github.com/github/awesome-copilot
- Categories
- Frontend & UI Code, Code Review & Quality
- First seen
- May 16, 2026
More from github/awesome-copilot
All 293- React18 Enzyme To Rtl743
- Linkedin Post Formatter362
- Ui Screenshots216
- Data Breach Blast Radius110
- Sql Server Table Reconciliation106
- 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.7K
- Excalidraw Diagram Generator34.6K
- Multi Stage Dockerfile31.7K
- Documentation Writer28.6K
- Prd24.6K
- Refactor22.7K
- Java Springboot22.1K
- Create Readme19.6K
- Playwright Generate Test18.3K
Similar to React18 String Refs
More Frontend & UI Code
react18-lifecycle-patternsgithub/awesome-copilot746 installsMigrates the three unsafe class lifecycle methods to React 18.3.1 patterns using semantic decision tables.
react19-source-patternsgithub/awesome-copilot995 installsMigration reference covering React 19 source-file changes, from ReactDOM API updates to ref and context rewrites.
react-modernizationwshobson/agents13.2K installsUpgrade guide for React apps covering version migrations, class-to-hooks conversion, and concurrent features.
vue-jsx-best-practicesvuejs-ai/skills12.1K installsVue JSX syntax guidance covering class vs className and differences from React JSX.
react-best-practicesalleneubank/claude-code3K installsDecision-tree guide for React components that steers logic away from unnecessary Effects toward render, events, and refs.
react-devsoftaworks/agent-toolkit4.2K installsType-safe React 18-19 patterns covering generic components, event typing, hooks, and router integration.