AI Skill Report Card

Implementing React Native Networking

B+78·Feb 23, 2026·Source: Extension-selection

React Native Networking Implementation

15 / 15
JavaScript
import React, { useState, useEffect } from 'react'; import { FlatList, Text, View, ActivityIndicator } from 'react-native'; const DataList = () => { const [data, setData] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { fetch('https://api.example.com/items') .then(response => response.json()) .then(result => { setData(result); setLoading(false); }) .catch(error => console.error(error)); }, []); if (loading) return <ActivityIndicator size="large" />; return ( <FlatList data={data} keyExtractor={item => item.id.toString()} renderItem={({ item }) => ( <View> <Text>{item.title}</Text> </View> )} /> ); };
Recommendation
Add concrete input/output pairs showing actual API responses and rendered UI components instead of just describing what happens
13 / 15

Progress:

  • Set up state management (data, loading, error)
  • Create fetch function with proper error handling
  • Implement useEffect for data loading
  • Add loading and error UI states
  • Configure FlatList with fetched data
  • Handle pull-to-refresh and pagination

Step 1: State Setup

JavaScript
const [data, setData] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); const [refreshing, setRefreshing] = useState(false);

Step 2: Fetch Function

JavaScript
const fetchData = async () => { try { setLoading(true); const response = await fetch('https://api.example.com/data'); const result = await response.json(); setData(result); setError(null); } catch (err) { setError(err.message); } finally { setLoading(false); } };

Step 3: Pull-to-Refresh

JavaScript
const onRefresh = async () => { setRefreshing(true); await fetchData(); setRefreshing(false); };
Recommendation
Include a complete networking utility template with error handling, retry logic, and request cancellation that can be dropped into any project
12 / 20

Example 1: User List Input: API endpoint returning user data

JavaScript
fetch('https://jsonplaceholder.typicode.com/users')

Output: FlatList displaying user names and emails

Example 2: Posts with Pagination Input: Paginated posts API

JavaScript
const [page, setPage] = useState(1); const loadMore = () => { fetch(`https://api.example.com/posts?page=${page + 1}`) .then(response => response.json()) .then(newData => { setData([...data, ...newData]); setPage(page + 1); }); };

Output: Infinite scroll list with onEndReached

Example 3: Search Integration

JavaScript
const [searchQuery, setSearchQuery] = useState(''); const searchData = useCallback( debounce(async (query) => { const response = await fetch(`https://api.example.com/search?q=${query}`); const results = await response.json(); setData(results); }, 300), [] );
Recommendation
Replace the vague 'Best Practices' section with specific code patterns for common networking scenarios like authentication headers, request interceptors, and offline handling
  • Use async/await instead of Promise chains for cleaner code
  • Implement proper error boundaries and error states
  • Add loading indicators for better UX
  • Use FlatList instead of ScrollView for large datasets
  • Implement pull-to-refresh with refreshing prop
  • Cache data when appropriate to reduce API calls
  • Use AbortController for request cancellation
  • Validate response data before setting state
  • Handle network connectivity issues gracefully
  • Don't forget to handle loading and error states in UI
  • Don't use fetch without error handling
  • Avoid setting state after component unmount (memory leaks)
  • Don't make API calls directly in render function
  • Don't forget keyExtractor prop in FlatList
  • Avoid blocking the main thread with large data processing
  • Don't ignore HTTP status codes (fetch doesn't reject on 4xx/5xx)
  • Don't hardcode API endpoints - use environment variables
0
Grade B+AI Skill Framework
Scorecard
Criteria Breakdown
Quick Start
15/15
Workflow
13/15
Examples
12/20
Completeness
10/20
Format
15/15
Conciseness
13/15