بنقرة واحدة
react-native-data-fetching-api
Guidelines for managing server state, queries, and API clients in React Native.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Guidelines for managing server state, queries, and API clients in React Native.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Mandatory rules and components for handling keyboard avoidance smoothly in the React Native app.
How to correctly handle and format protobuf Timestamp dates sent by the API Gateway to prevent "Invalid Date" issues.
Senior-level React Native architecture and patterns for Expo 54 apps.
Strict coding standards, naming conventions, file size limits, and typing rules.
Best practices for implementing forms with React Hook Form and Zod.
Mandatory rule to never use deprecated APIs or ignore deprecation warnings.
| name | React Native Data Fetching & API |
| description | Guidelines for managing server state, queries, and API clients in React Native. |
This app uses TanStack React Query coupled with a custom Axios API Client.
apiFetch)All network requests MUST use the internal apiFetch wrapper located in src/api/client.ts.
import { apiFetch } from '@/api/client';
// Example of a typical fetch call
const fetchUser = async (userId: string) => {
return apiFetch<UserResponse>(`/users/${userId}`, {
method: 'GET',
requiresAuth: true,
});
};
axios directly in your screens or hooks.apiFetch automatically handles Authorization Headers and Error wrapping.Use React Query for all server state management.
['users', userId].Always wrap useQuery and useMutation in custom hooks.
// ❌ BAD
const { data } = useQuery({ queryKey: ['users'], queryFn: fetchUsers });
// ✅ GOOD
export const useUsers = () => {
return useQuery({
queryKey: ['users'],
queryFn: fetchUsers,
});
};
apiFetch throws errors using the custom createApiError factory.useMutation, handle errors gracefully, typically by showing a toast or alert, but prefer doing it within the component's onError callback or via a global error boundary.[!IMPORTANT] Do not use
useEffect+useStateto fetch data. React Query is the standard.