Rest Countries Api using React and Tailwind

Solution retrospective
- Successfully implementing a responsive, accessible dark mode that persists across sessions
- Creating a clean component architecture with proper separation of concerns
- Building an efficient search and filter system that works across multiple data points
- Implementing proper error handling and loading states for a better user experience
- Add more comprehensive error boundaries for better error handling
- Consider using TypeScript from the start for better type safety
-
Border Countries Data Fetching
- Challenge: Needed to make multiple API calls to get border country names
- Solution: Implemented bulk fetching using SWR and proper loading states
const { data: borderCountries } = useSWR( () => borders?.length > 0 ? `https://restcountries.com/v3.1/alpha?codes=${borders.join(',')}` : null, fetcher );
-
Navigation History
- Challenge: Back button wasn't working as expected with nested routes
- Solution: Used
useNavigate(-1)
for proper browser history integration
-
Form State Management
- Challenge: Deciding where to place search/filter state
- Solution: Lifted state to parent component while keeping form logic encapsulated
-
Performance Optimization
- Best practices for reducing unnecessary re-renders
- Strategies for optimizing API calls and caching
-
State Management
- When to use Context vs. Props vs. State Management Libraries
- Better patterns for managing complex state
-
Accessibility
- Ensuring the application meets WCAG standards
- Improving keyboard navigation and screen reader support
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on Kamran Kiani's solution.
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord