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 पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
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:
- Create the context object (usually a new file)
- Update the provider component
- 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 consumerreferences/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
कमेंट
- …
इस 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 सुनिश्चित करने में उपयोगी है।
मिलती-जुलती skills
angular-developer
280kआपके एजेंट को Angular code बनाने और प्रोजेक्ट स्ट्रक्चर पर सलाह देने में मदद करता है। नए प्रोजेक्ट शुरू करने, code के हिस्से बनाने, या performance और accessibility सुधारने में उपयोगी है।
frontend-a11y
280kआपके एजेंट को web interfaces को सबके लिए accessible बनाने में मदद करता है। यह सुनिश्चित करता है कि websites और apps screen readers और keyboard navigation के साथ अच्छे से काम करें।
frontend-patterns
280kआपके एजेंट को React और Next.js में frontend development के modern patterns लागू करने में मदद करता है। यह performance optimize करता है, state manage करता है और best practices फॉलो करवाता है।