Saltar al contenido
Skillpedia
Sitios e interfaces (frontend)40 mil · #7386

react18-legacy-context

Qué hace

Esta herramienta te ayuda a actualizar el código antiguo de React para usar un sistema más nuevo llamado 'createContext'. Te guía para reemplazar las partes obsoletas del código que gestionan el intercambio de datos entre componentes.

Cuándo usarla

  • ✓Cuando veas advertencias sobre 'contextTypes' o 'getChildContext' en tu código de React.
  • ✓Cuando actualices una aplicación de React a versiones más nuevas (React 18 o superior).
  • ✓Antes de modificar cualquier código relacionado con el intercambio de datos entre componentes antiguos de React.

Link de la skill

https://github.com/github/awesome-copilot/blob/main/skills/react18-legacy-context/SKILL.md

Cópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.

Cómo usar

La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.

Mensaje listo para pegar

Usa esta skill para ayudarme: https://github.com/github/awesome-copilot/blob/main/skills/react18-legacy-context/SKILL.md Lee el archivo SKILL.md de ese link y sigue sus instrucciones en mi tarea.
¿Quieres que tu IA encuentre skills como esta por sí sola?Instala el MCP gratis de Skillpedia: una línea, y busca entre 15.000+ skills antes de cada tarea.Instalar en 1 minuto →

Ejemplo de qué pedirle a la IA

“¿Cómo actualizo el sistema de contexto antiguo de React al nuevo 'createContext'?”

5 skills nuevas por semana. 1 minuto de lectura.

Cómo funciona

La herramienta identifica dónde se comparten los datos (proveedores) y dónde se usan (consumidores). Después te ofrece un plan paso a paso para crear un nuevo archivo de contexto y actualizar tanto los proveedores como todos los consumidores para usar la nueva API.

Contenido técnico (SKILL.md original)

Texto original del autor, en inglés, directo de GitHub.

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
Preguntas frecuentes

¿Qué son 'contextTypes', 'childContextTypes' y 'getChildContext'?

Son formas antiguas que tenía React para compartir datos entre componentes. Han sido reemplazadas por un enfoque más moderno y flexible llamado 'createContext'.

¿Por qué tengo que actualizar todos los consumidores?

Si no actualizas todos los lugares que usan los datos antiguos, tu aplicación podría dejar de funcionar correctamente o mostrar información incorrecta.

¿Qué son un 'proveedor' y un 'consumidor'?

El 'proveedor' es el componente que suministra los datos. Los 'consumidores' son los componentes que reciben y usan esos datos.

Detalles

Descripción original del autor

Provides the complete migration pattern for React legacy context API (contextTypes, childContextTypes, getChildContext) to the modern createContext API. Use this skill whenever migrating legacy context in class components - this is always a cross-file migration requiring the provider AND all consumers to be updated together. Use it before touching any contextTypes or childContextTypes code, becaus

repo: github/awesome-copilot

Popularidad

Estrellas en GitHub
40 mil
Posición en el ranking
#7386
Licencia
MIT
Actualizada
15/10/2026

¿Te sirve esta skill?

0

Entra para votar.

Comentarios

  • …

Más skills de este repositorio

Skills parecidas