react-native-patterns
यह क्या करती है
यह गाइड बताती है कि React Native और Expo का उपयोग करके मोबाइल ऐप्स कैसे व्यवस्थित करें और बनाएँ। इसमें navigation, डेटा मैनेजमेंट, लिस्ट दिखाने, styling और फ़ोन की सुविधाओं के इस्तेमाल की अच्छी प्रैक्टिस बताई गई है।
कब इस्तेमाल करें
- ✓React Native ऐप में नई screens या components बनाते समय।
- ✓यह तय करते समय कि यूज़र ऐप की screens के बीच कैसे जाएगा।
- ✓ऐप में जानकारी कहाँ और कैसे स्टोर और लाई जाए, यह तय करते समय।
Skill का लिंक
https://github.com/affaan-m/ECC/blob/main/pi/core/skills/react-native-patterns/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“Expo Router का उपयोग करके मैं अपनी React Native ऐप की screens के बीच navigation कैसे व्यवस्थित करूँ?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
गाइड सुझाती है कि Expo Router से screens को फ़ाइलों के आधार पर व्यवस्थित करें। यह यह भी समझाती है कि डेटा के प्रकार (server, client, forms) अलग-अलग कैसे रखें, और TanStack Query जैसी लाइब्रेरी से डेटा कुशलता से कैसे लाएँ।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
React Native / Expo Patterns
Practical patterns for building production React Native apps with Expo. Covers navigation, state, data fetching, lists, styling, and native APIs. Pairs with the rules/react-native/ ruleset: rules say what to enforce, this skill shows how.
Libraries named below (NativeWind, Zustand/Jotai, TanStack Query) are common, well-established options shown for illustration — the patterns matter more than the specific package, and any equivalent works. Zod is used for validation to stay consistent with ECC's existing typescript/ rules.
These patterns assume the managed Expo workflow (Expo Router, EAS, expo-* modules) on the New Architecture (the default in recent Expo SDKs, mandatory from SDK 55+). They do NOT assume the browser DOM — React Native has no <div>, no URL bar, and no web data-fetching defaults.
When to Activate
Use this skill when:
- Building or editing React Native / Expo screens, components, or navigation
- Setting up routing with Expo Router (file-based
app/directory) - Deciding where state belongs (server cache vs client store vs route params vs form)
- Wiring data fetching with TanStack Query and validating responses with Zod
- Rendering long or heavy lists
- Choosing or applying a styling approach (NativeWind or StyleSheet)
- Accessing native device APIs (camera, location, notifications) or secure storage
- Reviewing RN code for mobile-specific issues
Do NOT use the web/React-DOM patterns here — URL-as-state, <div>, and SWR-for-browser do not apply to React Native.
Core Concepts
Project structure (Expo Router)
File-based routing under app/. Keep route files thin: they read and validate params, then delegate to a screen component that lives in components/ or features/.
app/
_layout.tsx # root stack
(tabs)/
_layout.tsx # tab navigator
index.tsx # Home
user/[id].tsx # dynamic route
components/
features/
user/UserProfile.tsx
Navigation: validate route params
Deep links and dynamic routes deliver untrusted strings. Validate them with Zod before use.
// app/user/[id].tsx
import { useLocalSearchParams, router } from 'expo-router'
import { z } from 'zod'
import { UserProfile } from '@/features/user/UserProfile'
const Params = z.object({ id: z.string().uuid() })
export default function UserRoute() {
const parsed = Params.safeParse(useLocalSearchParams())
if (!parsed.success) {
router.replace('/not-found')
return null
}
return <UserProfile userId={parsed.data.id} />
}
State: keep concerns separate
Do not duplicate server data into a client store. Each concern has its own home.
| Concern | Common choices |
|---|---|
| Server state (remote data) | a server-cache library (TanStack Query, SWR) |
| Client/UI state | a lightweight store (Zustand, Jotai) or Context |
| Route/navigation state | Expo Router params |
| Form state | a form library (e.g. React Hook Form) + schema validation |
| Secrets / tokens | expo-secure-store |
| Non-secret persistence | AsyncStorage / MMKV |
Prefer local useState until state genuinely needs sharing.
Data fetching: a cache library + Zod
Use a server-cache library (TanStack Query, SWR) instead of fetch-in-useEffect. Validate at the boundary and infer types from the schema. Handle loading, error, and empty states explicitly. (Example uses TanStack Query.)
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import { z } from 'zod'
const User = z.object({ id: z.string(), email: z.string().email() })
type User = z.infer<typeof User>
export function useUser(id: string) {
return useQuery({
queryKey: ['user', id],
queryFn: async (): Promise<User> => User.parse(await api.getUser(id)),
})
}
export function useUpdateEmail(id: string) {
const qc = useQueryClient()
return useMutation({
mutationFn: (email: string) => api.updateEmail(id, email),
onSuccess: () => qc.invalidateQueries({ queryKey: ['user', id] }),
})
}
Lists: virtualize, never map a big array in a ScrollView
import { FlatList } from 'react-native'
<FlatList
data={items}
keyExtractor={(item) => item.id}
renderItem={renderItem} // memoized
initialNumToRender={10}
windowSize={5}
/>
Use FlashList (Shopify) for large or heterogeneous lists.
Styling: pick one system
…
अक्सर पूछे जाने वाले सवाल
Expo Router क्या है?
यह React Native ऐप की screens को फ़ाइलों के आधार पर व्यवस्थित करने का तरीका है, जहाँ फ़ोल्डर की संरचना ही navigation तय करती है।
डेटा के प्रकार अलग क्यों करें?
डेटा अलग रखने से कोड व्यवस्थित रहता है और सर्वर की जानकारी ऐप में बेवजह दोहराई नहीं जाती।
लंबी लिस्ट को कुशलता से कैसे दिखाएँ?
गाइड “virtualization” जैसी तकनीकों की सलाह देती है, जैसे FlatList जैसे components का उपयोग, ताकि बहुत सारे आइटम दिखाने पर ऐप धीमा न हो।
जानकारी
लेखक का मूल विवरण
React Native and Expo app patterns — Expo Router navigation, state separation (server/client/route/form), TanStack Query data fetching with Zod, performant lists, NativeWind/StyleSheet styling, native APIs, and secure storage. Use when building or editing React Native / Expo screens, components, navigation, or data layers.
repo: affaan-m/ECC
लोकप्रियता
- GitHub स्टार
- 280k
- रैंकिंग में स्थान
- #236
- लाइसेंस
- MIT
- अपडेट की गई
- 15/10/2026
कमेंट
- …
इस repository की और skills
accessibility
280kयह आपके एजेंट को ऐसे इंटरफ़ेस बनाने में मदद करता है जिन्हें हर कोई इस्तेमाल कर सके। यह पक्का करता है कि वेबसाइट और ऐप दिव्यांग लोगों के लिए भी अच्छे से काम करें, जैसे नेत्रहीन या जिन्हें चलने-फिरने में दिक्कत होती है।
agent-architecture-audit
280kयह आपके एजेंट को जाँचने देता है कि सब कुछ सही से चल रहा है। यह AI सिस्टम में समस्याएँ ढूँढकर ठीक करता है, ताकि वे उम्मीद के मुताबिक काम करें।
agent-eval
280kयह आपके एजेंट को अलग-अलग AI coding tools की तुलना करने में मदद करता है। यह मापता है कि किसी खास काम के लिए कौन सा टूल ज़्यादा तेज़, सस्ता और भरोसेमंद है।
agent-harness-construction
280kयह आपके एजेंट को काम कैसे करना है, यह बेहतर समझने में मदद करता है। यह उन tools और instructions को बेहतर बनाता है जिनका एजेंट इस्तेमाल करता है, ताकि उसकी सफलता की संभावना बढ़े।
मिलती-जुलती skills
flutter-animating-apps
101kएजेंट को Flutter ऐप्स में एनिमेटेड इफ़ेक्ट और ट्रांज़िशन जोड़ने देता है। iOS और Android ऐप्स में मोशन और विज़ुअल डिज़ाइन बनाने के लिए यह उपयोगी है।
agent-spec-mobile-react-native
81kआपके एजेंट को React Native से iPhone और Android के लिए मोबाइल ऐप बनाने में मदद करती है, जिसमें screens, navigation और native modules शामिल हैं।
orientation
75kयह आपके एजेंट को सुनिश्चित करने में मदद करती है कि साइट पोर्ट्रेट और लैंडस्केप दोनों में चले, और ओरिएंटेशन लॉक व डिवाइस घुमाने के संदेश हटाए जाएँ।