A comprehensive learning path that transforms a simple master-detail view into a fully-featured, production-ready React application. This project provides 30 progressive challenges that build upon each other, teaching essential React patterns, state management, API integration, and testing strategies.
This repository contains a complete React learning curriculum that evolves from basic static components to a sophisticated application with:
- Modern React Patterns: Hooks, Context, useReducer, and advanced component architecture
- State Management Evolution: Local state β Context β Redux Toolkit β RTK Query
- API Integration: Data fetching, optimistic updates, caching, and error handling
- Testing Pyramid: Unit tests, integration tests, and end-to-end testing with Playwright
- Production Features: Routing, forms, validation, and performance optimization
- Node.js 18+
- npm or yarn
# Clone the repository
git clone https://github.com/onehungrymind/react-fundamental-cycle.git
cd react-fundamental-cycle
# Install dependencies
npm install
# Start the development server
npm run dev
npm run dev # Start Next.js development server
npm run build # Build for production
npm run start # Start production server
npm run test # Run all unit tests with coverage
npm run test:unit # Run unit tests only
npm run test:e2e # Run Playwright end-to-end tests
npm run lint # Run ESLint
Each challenge is self-contained in its own directory:
challenges/
βββ 01-static-master-detail-layout/
β βββ CHALLENGE.md # Challenge description and requirements
β βββ solution/
β βββ Solution.tsx # Complete working solution
β βββ __tests__/
β βββ solution.test.tsx # Unit tests
βββ 02-reusable-listitem-component/
β βββ ...
- Read the Challenge: Start with
CHALLENGE.md
in each challenge directory - Understand Requirements: Review the objective, requirements, and expected outcomes
- Implement Your Solution: Create your own implementation based on the requirements
- Test Your Work: Run
npm run test
to verify your solution passes the tests - Compare with Solution: Review the provided
Solution.tsx
to learn from the reference implementation - Move to Next Challenge: Each challenge builds upon the previous ones
The project includes:
- Base Application: A working master-detail app in
app/
for experimentation - API Endpoints: Mock API at
/api/items
for data fetching challenges - Testing Setup: Jest + React Testing Library for unit tests
- E2E Testing: Playwright for end-to-end testing
- TypeScript: Full TypeScript support throughout
- Challenge 01: Static Master-Detail Layout - Basic component structure
- Challenge 02: Reusable ListItem Component - Component composition
- Challenge 03: Conditional Detail View - Conditional rendering
- Challenge 04: Render Dynamic Lists - Dynamic data rendering
- Challenge 05: Composition with Card - Component composition patterns
- Challenge 06: Styling the UI - CSS and layout fundamentals
- Challenge 07: Selectable List Items - Event handling and state
- Challenge 08: Controlled Filter Input - Controlled components
- Challenge 09: Form to Add New Items - Form handling
- Challenge 10: Immutability in Updates - Immutable state patterns
- Challenge 11: Derived State Discipline - Computed values
- Challenge 12: Reset Detail on Filter Change - State synchronization
- Challenge 13: Lift State Up - State lifting patterns
- Challenge 14: Context vs Prop Drilling - React Context
- Challenge 15: useReducer for Complex Updates - Complex state management
- Challenge 16: Context + Reducer - Combined state patterns
- Challenge 17: Container-Presenter Split - Component architecture
- Challenge 18: Remote List Fetch - API integration
- Challenge 19: Remote Detail Fetch - Individual data fetching
- Challenge 20: Persist New Item - Data persistence
- Challenge 21: Optimistic Updates - Optimistic UI patterns
- Challenge 22: Route-Based Selection - Routing integration
- Challenge 23: Redux Toolkit Store - Redux setup
- Challenge 24: Selectors & Normalization - Data optimization
- Challenge 25: Async Thunks for API - Redux async patterns
- Challenge 26: RTK Query Caching - Advanced caching
- Challenge 27: Multi-Step Form - Complex form patterns
- Challenge 28: Basic Testing - Unit testing
- Challenge 29: Integration Testing - Integration testing
- Challenge 30: End-to-End Testing - E2E testing
- Framework: Next.js 15 with App Router
- Language: TypeScript
- Testing: Jest + React Testing Library + Playwright
- State Management: React hooks β Context β Redux Toolkit β RTK Query
- Styling: CSS modules and global styles
- API: Next.js API routes for backend simulation
- Component Patterns: Presenter/Container, Composition, HOCs
- State Management: Local state, Context, Redux patterns
- Data Flow: Props, Context, Redux, RTK Query
- Performance: Memoization, optimization, caching
- Testing: Unit, integration, and E2E testing strategies
- User Experience: Loading states, error handling, optimistic updates
- Each challenge includes comprehensive unit tests
- Tests cover component rendering, user interactions, and edge cases
- Run with:
npm run test
- Test complete workflows and component interactions
- Mock API calls for reliable testing
- Verify data flow and state management
- Playwright tests for complete user journeys
- Test real browser interactions
- Run with:
npm run test:e2e
By completing all 30 challenges, you'll have built a production-ready React application with:
β
Solid Foundation: Understanding of React fundamentals and patterns
β
State Management: Mastery of local state, Context, and Redux
β
API Integration: Experience with data fetching, caching, and error handling
β
Testing Expertise: Comprehensive testing strategies and best practices
β
Performance Optimization: Knowledge of React performance patterns
β
Architecture Skills: Ability to design scalable React applications
This is a learning resource designed to help developers master React patterns. Feel free to:
- Fork the repository for personal learning
- Submit issues for improvements or clarifications
- Share your solutions and learnings with the community
This project is open source and available under the MIT License.
Ready to start your React journey? Begin with Challenge 01 and build your way to a production-ready React application!