react-modernization
यह क्या करती है
यह टूल आपके React प्रोग्रामिंग कोड को नवीनतम वर्शन में अपडेट करने में मदद करता है। यह पुराने components को 'hooks' नाम के आधुनिक फ़ॉर्मेट में भी बदल सकता है और आपके कोड को React के नए फ़ीचर्स के हिसाब से ढाल सकता है।
कब इस्तेमाल करें
- ✓जब आपको अपने React प्रोजेक्ट को नए वर्शन में अपडेट करना हो।
- ✓जब पुराने components (classes) को आधुनिक फ़ॉर्मेट (hooks) में बदलना हो।
- ✓'concurrent features' जैसे React के नए फ़ीचर्स इस्तेमाल करने के लिए।
Skill का लिंक
https://github.com/wshobson/agents/blob/main/plugins/framework-migration/skills/react-modernization/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“इस React कोड को नवीनतम वर्शन में अपडेट करो और hooks का इस्तेमाल करो।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
टूल आपके React कोड का विश्लेषण करता है और नए वर्शन या hooks फ़ॉर्मेट के लिए ज़रूरी बदलाव अपने आप लागू करता है। यह 'codemods' का इस्तेमाल करता है, जो कोड को दोबारा व्यवस्थित करने के लिए ऑटोमेशन स्क्रिप्ट जैसे होते हैं।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
React Modernization
Master React version upgrades, class to hooks migration, concurrent features adoption, and codemods for automated transformation.
When to Use This Skill
- Upgrading React applications to latest versions
- Migrating class components to functional components with hooks
- Adopting concurrent React features (Suspense, transitions)
- Applying codemods for automated refactoring
- Modernizing state management patterns
- Updating to TypeScript
- Improving performance with React 18+ features
Version Upgrade Path
React 16 → 17 → 18
Breaking Changes by Version:
React 17:
- Event delegation changes
- No event pooling
- Effect cleanup timing
- JSX transform (no React import needed)
React 18:
- Automatic batching
- Concurrent rendering
- Strict Mode changes (double invocation)
- New root API
- Suspense on server
Class to Hooks Migration
State Management
// Before: Class component
class Counter extends React.Component {
constructor(props) {
super(props);
this.state = {
count: 0,
name: "",
};
}
increment = () => {
this.setState({ count: this.state.count + 1 });
};
render() {
return (
<div>
<p>Count: {this.state.count}</p>
<button onClick={this.increment}>Increment</button>
</div>
);
}
}
// After: Functional component with hooks
function Counter() {
const [count, setCount] = useState(0);
const [name, setName] = useState("");
const increment = () => {
setCount(count + 1);
};
return (
<div>
<p>Count: {count}</p>
<button onClick={increment}>Increment</button>
</div>
);
}
Lifecycle Methods to Hooks
// Before: Lifecycle methods
class DataFetcher extends React.Component {
state = { data: null, loading: true };
componentDidMount() {
this.fetchData();
}
componentDidUpdate(prevProps) {
if (prevProps.id !== this.props.id) {
this.fetchData();
}
}
componentWillUnmount() {
this.cancelRequest();
}
fetchData = async () => {
const data = await fetch(`/api/${this.props.id}`);
this.setState({ data, loading: false });
};
cancelRequest = () => {
// Cleanup
};
render() {
if (this.state.loading) return <div>Loading...</div>;
return <div>{this.state.data}</div>;
}
}
// After: useEffect hook
function DataFetcher({ id }) {
const [data, setData] = useState(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
let cancelled = false;
const fetchData = async () => {
try {
const response = await fetch(`/api/${id}`);
const result = await response.json();
if (!cancelled) {
setData(result);
setLoading(false);
}
} catch (error) {
if (!cancelled) {
console.error(error);
}
}
};
fetchData();
// Cleanup function
return () => {
cancelled = true;
};
}, [id]); // Re-run when id changes
if (loading) return <div>Loading...</div>;
return <div>{data}</div>;
}
Context and HOCs to Hooks
// Before: Context consumer and HOC
const ThemeContext = React.createContext();
class ThemedButton extends React.Component {
static contextType = ThemeContext;
render() {
return (
<button style={{ background: this.context.theme }}>
{this.props.children}
</button>
);
}
}
// After: useContext hook
function ThemedButton({ children }) {
const { theme } = useContext(ThemeContext);
return <button style={{ background: theme }}>{children}</button>;
}
// Before: HOC for data fetching
function withUser(Component) {
return class extends React.Component {
state = { user: null };
componentDidMount() {
fetchUser().then((user) => this.setState({ user }));
}
render() {
return <Component {...this.props} user={this.state.user} />;
}
};
}
// After: Custom hook
function useUser() {
const [user, setUser] = useState(null);
useEffect(() => {
fetchUser().then(setUser);
}, []);
return user;
}
function UserProfile() {
const user = useUser();
if (!user) return <div>Loading...</div>;
return <div>{user.name}</div>;
}
React 18 Concurrent Features
New Root API
// Before: React 17
import ReactDOM from "react-dom";
ReactDOM.render(<App />, document.getElementById("root"));
// After: React 18
…
अक्सर पूछे जाने वाले सवाल
'hooks' क्या हैं?
'Hooks' React के फ़ीचर्स का इस्तेमाल components में करने का एक आधुनिक और सरल तरीका है। कई मामलों में ये classes की जगह ले लेते हैं।
'concurrent features' क्या हैं?
ये React के नए फ़ीचर्स हैं (वर्शन 18 से), जिनसे भारी काम के दौरान भी यूज़र इंटरफ़ेस बेहतर और तेज़ी से प्रतिक्रिया दे पाता है।
'codemods' क्या हैं?
'Codemods' ऐसे टूल हैं जो कोड को एक फ़ॉर्मेट से दूसरे फ़ॉर्मेट में अपने आप बदलने में मदद करते हैं, जैसे syntax अपडेट करना या classes से hooks में माइग्रेट करना।
जानकारी
लेखक का मूल विवरण
Upgrade React applications to latest versions, migrate from class components to hooks, and adopt concurrent features. Use when modernizing React codebases, migrating to React Hooks, or upgrading to latest React versions.
repo: wshobson/agents
लोकप्रियता
- GitHub स्टार
- 41k
- रैंकिंग में स्थान
- #6698
- लाइसेंस
- MIT
- अपडेट की गई
- 15/10/2026
कमेंट
- …
इस repository की और skills
screen-reader-testing
41kआपके एजेंट को screen readers का इस्तेमाल करके वेबसाइटों की जांच करने देता है, ताकि यह पक्का हो सके कि वे accessible हैं।
wcag-audit-patterns
41kआपके एजेंट को वेबसाइटों का accessibility audit करने और WCAG guidelines के हिसाब से समस्याएं ठीक करने में मदद करता है।
multi-reviewer-patterns
41kआपके एजेंट को कई code reviews को एक साथ चलाने देता है। यह एक जैसे findings हटाता है और सारी रिपोर्ट को एक जगह जोड़ता है।
parallel-debugging
41kआपके एजेंट को parallel जांच के साथ जटिल समस्याओं को debug करने और root cause analysis में मदद करता है।
मिलती-जुलती 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 फॉलो करवाता है।