)
}
```
## Best Practices
- Type-safe APIs with TypeScript
- Error boundaries for API errors
- Loading and error states
- Optimistic updates for better UX
- Cache invalidation strategies
- Request deduplication
- Retry failed requests
- Authentication handling
## When to Use This Skill
Use when you need to:
- Integrate REST or GraphQL APIs
- Set up React Query or SWR
- Implement real-time updates
- Add optimistic updates
- Handle pagination/infinite scroll
- Manage API caching
- Build offline-capable apps
## Output Format
Provide:
1. **API Client Setup**: Axios/Fetch configuration
2. **Query Hooks**: Type-safe data fetching
3. **Mutation Hooks**: Data modification
4. **Caching Strategy**: How data is cached
5. **Error Handling**: Error boundaries and fallbacks
6. **Testing**: API mocking and tests