본문으로 건너뛰기
Skillpedia
웹사이트 및 UI (프런트엔드)40k · #7386

react18-legacy-context

하는 일

이 도구는 오래된 React 코드를 'createContext'라는 최신 시스템을 쓰도록 업데이트하도록 돕습니다. 컴포넌트 사이에서 데이터를 공유하는 오래된 부분을 교체하는 과정을 안내합니다.

사용하는 경우

  • ✓React 코드에서 'contextTypes'나 'getChildContext'에 대한 경고가 보일 때.
  • ✓React 애플리케이션을 최신 버전(React 18 이상)으로 업데이트할 때.
  • ✓오래된 React 컴포넌트 데이터 공유와 관련된 코드를 수정하기 전에.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/github/awesome-copilot/blob/main/skills/react18-legacy-context/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“React의 오래된 컨텍스트 시스템을 새 'createContext'로 어떻게 업데이트하나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

도구는 데이터가 공유되는 곳(제공자)과 사용되는 곳(소비자)을 확인합니다. 그다음 새 컨텍스트 파일을 만들고, 제공자와 모든 소비자를 새 API를 쓰도록 바꾸는 단계별 계획을 제공합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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
자주 묻는 질문

'contextTypes', 'childContextTypes', 'getChildContext'는 무엇인가요?

React에서 컴포넌트 사이에 데이터를 공유하던 오래된 방식입니다. 더 현대적이고 유연한 'createContext' 방식으로 대체되었습니다.

모든 소비자를 왜 업데이트해야 하나요?

오래된 데이터를 쓰는 곳을 모두 바꾸지 않으면, 애플리케이션이 제대로 작동하지 않거나 잘못된 정보를 보여 줄 수 있습니다.

'제공자(provider)'와 '소비자(consumer)'는 무엇인가요?

'제공자'는 데이터를 공급하는 컴포넌트입니다. '소비자'는 그 데이터를 받아 사용하는 컴포넌트입니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
40k
순위
#7386
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬