2026 में नए आर्किटेक्चर (जेएसआई + फैब्रिक), एक्सपो एसडीके 52 और रिएक्ट 19 सपोर्ट के साथ रिएक्ट नेटिव बिल्डिंग प्रोडक्शन मोबाइल ऐप्स को पहले से कहीं ज्यादा तेज बनाता है। यदि आप पहले से ही रिएक्ट को जानते हैं, तो रिएक्ट नेटिव आपको 85-90% साझा कोड के साथ आईओएस और एंड्रॉइड ऐप बनाने की सुविधा देता है। यह ट्यूटोरियल आवश्यक चीज़ों को शामिल करता है।
📋 Table of Contents
स्थापित करना
# Using Expo (recommended for new projects)
npx create-expo-app@latest MyApp
cd MyApp
npx expo start
# Or bare workflow (more control, more setup)
npx @react-native-community/cli@latest init MyApp --new-architecture
cd MyApp
npx pod-install # iOS only
npx react-native run-ios # requires macOS + Xcode
npx react-native run-android # requires Android Studio
मुख्य घटक
import {
View, Text, StyleSheet, Pressable,
ScrollView, FlatList, Image,
TextInput, SafeAreaView, Platform,
} from 'react-native';
// No div, span, p — use View and Text instead
export default function HomeScreen() {
return (
<SafeAreaView style={styles.container}>
<ScrollView>
<Text style={styles.title}>Hello React Native!</Text>
<Text style={styles.body}>
This runs on iOS and Android natively.
</Text>
<Pressable
style={({ pressed }) => [
styles.button,
pressed && styles.buttonPressed,
]}
onPress={() => console.log('Pressed!')}
>
<Text style={styles.buttonText}>Tap Me</Text>
</Pressable>
</ScrollView>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
},
title: {
fontSize: 28,
fontWeight: 'bold',
padding: 16,
// Platform-specific
...Platform.select({
ios: { fontFamily: 'SF Pro Display' },
android: { fontFamily: 'Roboto' },
}),
},
body: {
fontSize: 16,
color: '#555',
paddingHorizontal: 16,
lineHeight: 24,
},
button: {
backgroundColor: '#0066CC',
margin: 16,
padding: 16,
borderRadius: 12,
alignItems: 'center',
},
buttonPressed: {
opacity: 0.7,
transform: [{ scale: 0.98 }],
},
buttonText: {
color: 'white',
fontWeight: '600',
fontSize: 16,
},
});
रिएक्ट नेविगेशन के साथ नेविगेशन
npm install @react-navigation/native @react-navigation/native-stack
npm install react-native-screens react-native-safe-area-context
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
type RootStackParamList = {
Home: undefined;
Profile: { userId: number };
Settings: undefined;
};
const Stack = createNativeStackNavigator<RootStackParamList>();
export default function App() {
return (
<NavigationContainer>
<Stack.Navigator
initialRouteName="Home"
screenOptions={{
headerStyle: { backgroundColor: '#0066CC' },
headerTintColor: 'white',
}}
>
<Stack.Screen name="Home" component={HomeScreen} />
<Stack.Screen name="Profile" component={ProfileScreen} />
<Stack.Screen name="Settings" component={SettingsScreen} />
</Stack.Navigator>
</NavigationContainer>
);
}
// Navigate between screens
function HomeScreen({ navigation }) {
return (
<View>
<Pressable onPress={() => navigation.navigate('Profile', { userId: 1 })}>
<Text>Go to Profile</Text>
</Pressable>
</View>
);
}
function ProfileScreen({ route, navigation }) {
const { userId } = route.params; // typed!
return <Text>Profile {userId}</Text>;
}
डेटा फ़ेचिंग
import { useQuery, useMutation, QueryClient, QueryClientProvider } from '@tanstack/react-query';
const queryClient = new QueryClient();
// Wrap app
export default function App() {
return (
<QueryClientProvider client={queryClient}>
<NavigationContainer>...</NavigationContainer>
</QueryClientProvider>
);
}
// Fetch users
function UserList() {
const { data, isLoading, error } = useQuery({
queryKey: ['users'],
queryFn: () => fetch('https://api.example.com/users').then(r => r.json()),
});
if (isLoading) return <ActivityIndicator size="large" />;
if (error) return <Text>Error: {error.message}</Text>;
return (
<FlatList
data={data}
keyExtractor={user => user.id.toString()}
renderItem={({ item }) => (
<View style={styles.userCard}>
<Image source={{ uri: item.avatarUrl }} style={styles.avatar} />
<Text style={styles.userName}>{item.name}</Text>
</View>
)}
/>
);
}
स्थानीय भंडारण और राज्य
npm install @react-native-async-storage/async-storage
npm install zustand # lightweight state management
import AsyncStorage from '@react-native-async-storage/async-storage';
import { create } from 'zustand';
import { persist, createJSONStorage } from 'zustand/middleware';
// Zustand store with AsyncStorage persistence
interface UserStore {
user: User | null;
token: string | null;
setUser: (user: User, token: string) => void;
logout: () => void;
}
export const useUserStore = create<UserStore>()(
persist(
(set) => ({
user: null,
token: null,
setUser: (user, token) => set({ user, token }),
logout: () => set({ user: null, token: null }),
}),
{
name: 'user-storage',
storage: createJSONStorage(() => AsyncStorage),
}
)
);
// Usage in component
function ProfileScreen() {
const { user, logout } = useUserStore();
return (
<View>
<Text>Welcome, {user?.name}!</Text>
<Pressable onPress={logout}>
<Text>Logout</Text>
</Pressable>
</View>
);
}
एक्सपो राउटर (फ़ाइल-आधारित रूटिंग)
// app/(tabs)/index.tsx → "/" tab
// app/(tabs)/profile.tsx → "/profile" tab
// app/[id].tsx → dynamic route
// Expo Router — Next.js-style for mobile
import { Stack, Tabs } from 'expo-router';
export default function RootLayout() {
return <Stack />;
}
// app/(tabs)/_layout.tsx
export default function TabLayout() {
return (
<Tabs>
<Tabs.Screen name="index" options={{ title: 'Home' }} />
<Tabs.Screen name="profile" options={{ title: 'Profile' }} />
</Tabs>
);
}
ऐप स्टोर पर प्रकाशन
# Expo EAS (Expo Application Services) — recommended
npm install -g eas-cli
eas login
eas build:configure
# Build for production
eas build --platform ios # builds .ipa for App Store
eas build --platform android # builds .aab for Play Store
eas build --platform all # both simultaneously
# Submit to stores
eas submit --platform ios
eas submit --platform android
2026 में रिएक्ट नेटिव अधिकांश मोबाइल ऐप उपयोग के मामलों के लिए उत्पादन के लिए तैयार है। नया आर्किटेक्चर पुराने जावास्क्रिप्ट ब्रिज को खत्म कर देता है, जिससे एनिमेशन स्मूथ हो जाते हैं और नेटिव मॉड्यूल कॉल तेज हो जाते हैं। तेज़ विकास और सरल तैनाती के लिए एक्सपो का उपयोग करें – यदि आपको पूर्ण मूल पहुंच की आवश्यकता है तो आप हमेशा नंगे वर्कफ़्लो से बाहर निकल सकते हैं। यदि आप रिएक्ट जानते हैं, तो रिएक्ट नेटिव का सीखने का क्रम 2-4 सप्ताह में प्रबंधित किया जा सकता है।
🔗 Share this article
✍️ Leave a Comment