Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
github avatar

React18 String Refs

  • 746 installs
  • 37.1k repo stars
  • Updated July 28, 2026
  • github/awesome-copilot

react18-string-refs migrates string refs and this.refs to React.createRef in class components.

About

React 18 String Refs Migration converts ref="name" JSX and this.refs.name accessors to React.createRef fields and ref={this.refName} bindings. String refs warn in React 18.3.1 and are removed in React 19, matching the deprecation timeline of other legacy APIs. A pattern map routes single refs, multiple refs, list refs, callback refs, and forwarded child refs to references/patterns.md sections. Grep commands find both JSX string ref assignments and this.refs usage that must migrate as pairs within each component. The three-step rule adds a createRef class field, updates JSX ref binding, and replaces this.refs.name with this.refName.current everywhere.

  • String refs warn in React 18.3.1 and are removed in React 19.
  • Migrate ref="name" and this.refs.name together per component.
  • Pattern map covers single, multiple, list, callback, and forwarded refs.
  • Grep commands find JSX string refs and this.refs accessors.
  • Three-step rule: createRef field, JSX ref binding, .current accessor.

React18 String Refs by the numbers

  • 746 all-time installs (skills.sh)
  • +18 installs in the week ending Jul 17, 2026 (Skillselion tracking)
  • Ranked #458 of 2,277 Frontend Development skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

react18-string-refs capabilities & compatibility

Capabilities
string ref to createref three step migration rul · grep discovery for jsx refs and this.refs pairs · single, multiple, list, callback, and forwarded · react 18.3.1 warning and react 19 removal timeli · reference routing to patterns.md per ref shape
Use cases
refactoring · testing
From the docs

What react18-string-refs says it does

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**.
SKILL.md
Both should be migrated together - find the `ref="name"` and the `this.refs.name` accesses for each component as a pair.
SKILL.md
npx skills add https://github.com/github/awesome-copilot --skill react18-string-refs

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs746
repo stars37.1k
Security audit3 / 3 scanners passed
Last updatedJuly 28, 2026
Repositorygithub/awesome-copilot

How do I replace ref="name" and this.refs usage before React 19 removes string refs?

Migrate React string refs and this.refs accessors to React.createRef in class components before React 19 removal.

Who is it for?

Class components still using string refs or this.refs during React 18.3.1 upgrades.

Skip if: Skip for function components using useRef only, legacy context, or Enzyme test rewrites.

When should I use this skill?

grep finds ref=" in JSX or this.refs. accessors in class component source.

What you get

Paired grep discovery and createRef migration for single, multiple, list, and forwarded ref patterns.

  • createRef()-based class components
  • Updated ref access patterns

Files

SKILL.mdMarkdownGitHub ↗

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

PatternReference
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

Every string ref migrates to React.createRef():

1. Add refName = React.createRef(); as a class field (or in constructor) 2. Replace ref="refName"ref={this.refName} in JSX 3. Replace this.refs.refNamethis.refName.current everywhere

Read references/patterns.md for the full before/after for each case.

Related skills

How it compares

Pick react18-string-refs over generic React upgrade guides when the blocker is specifically deprecated string refs inside class components rather than hooks adoption.

FAQ

Are string refs supported in React 19?

No. They warn in React 18.3.1 and are removed in React 19.

Must I update JSX and JS together?

Yes. Migrate each ref="name" and its this.refs.name accesses as a pair per component.

How handle refs in a list?

See references/patterns.md list-refs section; list refs are a common migration trap.

Is React18 String Refs safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.