react18-string-refs
यह क्या करती है
यह टूल पुराने React कोड को नए वर्शन के लिए अपडेट करने में मदद करता है। यह टेक्स्ट रेफ़रेंस (जैसे `ref='myInput'`) को नए फ़ॉर्मेट (`React.createRef()`) में बदलता है, ताकि आपका कोड सही तरीके से चलता रहे।
कब इस्तेमाल करें
- ✓जब आप कोई पुराना React प्रोजेक्ट नए वर्शन में अपडेट कर रहे हों।
- ✓अगर आपके React कोड में 'string refs' को लेकर चेतावनी दिखे।
- ✓हाथ से रेफ़रेंस दोबारा लिखने से पहले।
Skill का लिंक
https://github.com/github/awesome-copilot/blob/main/skills/react18-string-refs/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“अपने React के 'string refs' को नए फ़ॉर्मेट में कैसे बदलूं?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
टूल पहचानता है कि आपके React कोड में टेक्स्ट रेफ़रेंस कहाँ इस्तेमाल हुए हैं। फिर वह ठीक वही पैटर्न दिखाता है जिससे उन्हें `React.createRef()` से बदला जा सकता है, जो आज के React वर्शन में सही तरीका है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
React 18 String Refs Migration
String refs (ref="myInput" + this.refs.myInput) were deprecated in React 16.3, warn in React 18.3.1, and are removed in React 19.
Quick Pattern Map
| Pattern | Reference |
|---|---|
| Single ref on a DOM element | → patterns.md#single-ref |
| Multiple refs in one component | → patterns.md#multiple-refs |
| Refs in a list / dynamic refs | → patterns.md#list-refs |
| Callback refs (alternative approach) | → patterns.md#callback-refs |
| Ref passed to a child component | → patterns.md#forwarded-refs |
Scan Command
# Find all string ref assignments in JSX
grep -rn 'ref="' src/ --include="*.js" --include="*.jsx" | grep -v "\.test\."
# Find all this.refs accessors
grep -rn "this\.refs\." src/ --include="*.js" --include="*.jsx" | grep -v "\.test\."
Both should be migrated together - find the ref="name" and the this.refs.name accesses for each component as a pair.
The Migration Rule
Every string ref migrates to React.createRef():
- Add
refName = React.createRef();as a class field (or in constructor) - Replace
ref="refName"→ref={this.refName}in JSX - Replace
this.refs.refName→this.refName.currenteverywhere
Read references/patterns.md for the full before/after for each case.
अक्सर पूछे जाने वाले सवाल
'string refs' क्या हैं?
ये React में किसी एलिमेंट को टेक्स्ट नाम से रेफ़र करने का पुराना तरीका है, जैसे `ref='myInput'`। अब इसकी जगह एक ज़्यादा सुरक्षित और आधुनिक तरीका आ गया है।
मुझे अपडेट क्यों करना है?
'string refs' अब deprecated हो चुके हैं और आने वाले React वर्शन में हटा दिए जाएंगे। अपडेट करने से आपका कोड आगे भी चलता रहेगा और नए वर्शन के साथ संगत रहेगा।
`React.createRef()` क्या है?
React में class कंपोनेंट्स के एलिमेंट्स के लिए रेफ़रेंस बनाने का सुझाया गया आधुनिक तरीका है। यह ज़्यादा सुरक्षित और साफ़ होता है।
जानकारी
लेखक का मूल विवरण
Provides exact migration patterns for React string refs (ref="name" + this.refs.name) to React.createRef() in class components. Use this skill whenever migrating string ref usage - including single element refs, multiple refs in a component, refs in lists, callback refs, and refs passed to child components. Always use this skill before writing any ref migration code - the multiple-refs-in-list pat
repo: github/awesome-copilot
लोकप्रियता
- GitHub स्टार
- 40k
- रैंकिंग में स्थान
- #7388
- लाइसेंस
- 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 फॉलो करवाता है।