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

React18 Legacy Context

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

react18-legacy-context migrates contextTypes and getChildContext to createContext across all providers and consumers.

About

React 18 Legacy Context Migration replaces contextTypes, childContextTypes, and getChildContext with the modern createContext API before React 19 removal. Unlike single-file migrations, context changes require coordinated updates to the provider, every consumer, and a new context module or the app reads undefined values at runtime. The prescribed order finds providers and consumers with grep, creates the context file, updates the provider, migrates class consumers via contextType and function consumers via useContext, then verifies no legacy warnings remain. Reference files cover single-context, multi-context, and context file template patterns. Legacy context warns in React 18.3.1 and is fully removed in React 19.

  • Always cross-file: provider, all consumers, and new context module together.
  • Ordered steps: find provider, find consumers, create context, migrate each file.
  • Grep commands locate childContextTypes, contextTypes, and this.context usage.
  • Class consumers use contextType; function consumers use useContext hook.
  • Removed in React 19; warns under React 18.3.1 today.

React18 Legacy Context by the numbers

  • 752 all-time installs (skills.sh)
  • +17 installs in the week ending Jul 18, 2026 (Skillselion tracking)
  • Ranked #457 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-legacy-context capabilities & compatibility

Capabilities
cross file provider and consumer coordination st · grep scan commands for legacy context symbols · class contexttype and function usecontext migrat · single and multi context reference routing · post migration warning verification checklist
Use cases
refactoring · testing
From the docs

What react18-legacy-context says it does

Unlike most other migrations that touch one file at a time, context migration requires coordinating:
SKILL.md
It is **removed in React 19**.
SKILL.md
npx skills add https://github.com/github/awesome-copilot --skill react18-legacy-context

Add your badge

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

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

How do I replace legacy React context without breaking consumers during a React 18 to 19 upgrade?

Migrate React legacy context API across provider and all consumer files to createContext before React 19 removes contextTypes support.

Who is it for?

Codebases still using contextTypes or getChildContext in class components ahead of React 19.

Skip if: Skip for apps already on createContext, string ref migrations, or dependency version checks.

When should I use this skill?

grep finds childContextTypes, getChildContext, or contextTypes before any context migration code.

What you get

Cross-file migration order with grep discovery, context module creation, and consumer updates for classes and functions.

  • Migrated createContext provider
  • Updated consumer class components

By the numbers

  • Legacy context deprecated in React 16.3 and removed in React 19
  • React 18.3.1 emits warnings for legacy contextTypes usage

Files

SKILL.mdMarkdownGitHub ↗

React 18 Legacy Context Migration

Legacy context (contextTypes, childContextTypes, getChildContext) was deprecated in React 16.3 and warns in React 18.3.1. It is removed in React 19.

This Is Always a Cross-File Migration

Unlike most other migrations that touch one file at a time, context migration requires coordinating: 1. Create the context object (usually a new file) 2. Update the provider component 3. Update every consumer component

Missing any consumer leaves the app broken - it will read from the wrong context or get undefined.

Migration Steps (Always Follow This Order)

Step 1: Find the provider (childContextTypes + getChildContext)
Step 2: Find ALL consumers (contextTypes)
Step 3: Create the context file
Step 4: Update the provider
Step 5: Update each consumer (class components → contextType, function components → useContext)
Step 6: Verify - run the app, check no legacy context warnings remain

Scan Commands

# Find all providers
grep -rn "childContextTypes\|getChildContext" src/ --include="*.js" --include="*.jsx" | grep -v "\.test\."

# Find all consumers
grep -rn "contextTypes\s*=" src/ --include="*.js" --include="*.jsx" | grep -v "\.test\."

# Find this.context usage (may be legacy or modern - check which)
grep -rn "this\.context\." src/ --include="*.js" --include="*.jsx" | grep -v "\.test\."

Reference Files

  • `references/single-context.md` - complete migration for one context (theme, auth, etc.) with provider + class consumer + function consumer
  • `references/multi-context.md` - apps with multiple legacy contexts (nested providers, multiple consumers of different contexts)
  • `references/context-file-template.md` - the standard file structure for a new context module

Related skills

How it compares

Pick react18-legacy-context when class components still use contextTypes or getChildContext and you need coordinated provider-consumer migration, not when starting fresh with function components and useContext.

FAQ

Can I migrate only the provider first?

No. Partial migration leaves consumers reading wrong or undefined context and breaks the app.

Is legacy context supported in React 19?

No. It warns in React 18.3.1 and is removed entirely in React 19.

How update class component consumers?

Set static contextType to the new context object and read this.context instead of legacy contextTypes.

Is React18 Legacy Context 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.