मुख्य सामग्री पर जाएँ
Skillpedia
वेबसाइट और UI (frontend)40k · #7386

react18-legacy-context

यह क्या करती है

यह टूल पुराने React कोड को नए सिस्टम 'createContext' का उपयोग करने के लिए अपडेट करने में मदद करता है। यह आपको उन पुराने हिस्सों को बदलने का तरीका बताता है जो कंपोनेंट्स के बीच डेटा शेयर करने का काम करते हैं।

कब इस्तेमाल करें

  • ✓जब आपके React कोड में 'contextTypes' या 'getChildContext' के बारे में चेतावनी दिखे।
  • ✓जब React ऐप्लिकेशन को नए वर्शन (React 18 या उससे ऊपर) में अपडेट कर रहे हों।
  • ✓किसी भी पुराने कोड को बदलने से पहले जो कंपोनेंट्स के बीच डेटा शेयर करने से जुड़ा हो।

Skill का लिंक

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

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/github/awesome-copilot/blob/main/skills/react18-legacy-context/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“React के पुराने context सिस्टम को नए 'createContext' में कैसे बदलूं?”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

टूल पहचानता है कि डेटा कहाँ शेयर किया जा रहा है (providers) और कहाँ इस्तेमाल हो रहा है (consumers)। फिर यह एक चरण-दर-चरण योजना देता है, जिसमें नई context फ़ाइल बनाना और सभी providers और consumers को नए 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' नाम के एक आधुनिक और ज़्यादा लचीले तरीके ने ले ली है।

मुझे सभी consumers को क्यों अपडेट करना होगा?

अगर आप उस हर जगह को अपडेट नहीं करते जहाँ पुराना डेटा इस्तेमाल हो रहा है, तो आपका ऐप्लिकेशन ठीक से काम करना बंद कर सकता है या गलत जानकारी दिखा सकता है।

'provider' और 'consumer' क्या होते हैं?

'provider' वह कंपोनेंट है जो डेटा देता है। 'consumers' वे कंपोनेंट्स हैं जो वह डेटा लेते और इस्तेमाल करते हैं।

जानकारी

लेखक का मूल विवरण

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
अपडेट की गई
15/10/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

acquire-codebase-knowledge

40k

आपके एजेंट को किसी मौजूदा code प्रोजेक्ट को समझने और उसका documentation बनाने में मदद करता है। यह नए लोगों को प्रोजेक्ट से जोड़ने या architecture का सार जानने में उपयोगी है।

लेखन और डॉक्यूमेंटडॉक्यूमेंटेशन

acreadiness-assess

40k

आपके एजेंट को किसी प्रोजेक्ट की AI के लिए तैयारी जाँचने और रिपोर्ट बनाने देता है। यह समझने में उपयोगी है कि प्रोजेक्ट AI tools इस्तेमाल करने के लिए कितना तैयार है।

लेखन और डॉक्यूमेंटडॉक्यूमेंटेशन

acreadiness-generate-instructions

40k

आपके एजेंट को assessment के आधार पर AI tools के लिए निर्देश बनाने में मदद करता है। यह बताता है कि AI कोड के साथ बेहतर कैसे काम करे और पहचानी गई कमियाँ कैसे दूर हों।

लेखन और डॉक्यूमेंटडॉक्यूमेंटेशन

acreadiness-policy

40k

आपके एजेंट को AI प्रोजेक्ट assessment के लिए नीतियाँ तय करने या लागू करने में मदद करता है। यह प्रोजेक्ट्स के मूल्यांकन को मानक बनाने और compliance सुनिश्चित करने में उपयोगी है।

AI और एजेंटएजेंट

मिलती-जुलती skills