Skip to content

onehungrymind/react-fundamental-cycle

Repository files navigation

Learn React Fundamentals

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.

🎯 Project Overview

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

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • npm or yarn

Installation & Setup

# 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

Available Scripts

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

πŸ“š How to Work Through the Challenges

Challenge Structure

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/
β”‚   └── ...

Working on Challenges

  1. Read the Challenge: Start with CHALLENGE.md in each challenge directory
  2. Understand Requirements: Review the objective, requirements, and expected outcomes
  3. Implement Your Solution: Create your own implementation based on the requirements
  4. Test Your Work: Run npm run test to verify your solution passes the tests
  5. Compare with Solution: Review the provided Solution.tsx to learn from the reference implementation
  6. Move to Next Challenge: Each challenge builds upon the previous ones

Development Environment

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

πŸ“‹ Table of Contents

Phase 1: Static UI Foundations

Phase 2: Adding Interactivity (Local State)

Phase 3: Scaling State

Phase 4: Remote Data & Effects

Phase 5: Advanced State Management

Phase 6: Forms & Testing

πŸ—οΈ Project Architecture

Technology Stack

  • 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

Key Concepts Covered

  • 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

πŸ§ͺ Testing Strategy

Unit Tests

  • Each challenge includes comprehensive unit tests
  • Tests cover component rendering, user interactions, and edge cases
  • Run with: npm run test

Integration Tests

  • Test complete workflows and component interactions
  • Mock API calls for reliable testing
  • Verify data flow and state management

End-to-End Tests

  • Playwright tests for complete user journeys
  • Test real browser interactions
  • Run with: npm run test:e2e

πŸŽ“ Learning Outcomes

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

🀝 Contributing

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

πŸ“„ License

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!

About

A training cycle to learn React fundamentals

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published