Skip to content

Latest commit

ย 

History

History
143 lines (108 loc) ยท 4.33 KB

File metadata and controls

143 lines (108 loc) ยท 4.33 KB

๐ŸŽฎ React Design Patterns

A comprehensive interactive course teaching React design patterns through Pokemon-themed examples. Learn advanced React patterns with hands-on exercises and real-world applications.

๐Ÿš€ What's Inside

This repository contains a complete React design patterns course built with:

  • React 19 with TypeScript
  • Storybook for interactive lessons and exercises
  • Tailwind CSS for styling
  • Vite for fast development
  • Pokemon theme to make learning engaging

๐Ÿ“š Course Structure

๐Ÿฅ‰ Bronze Level (Fundamentals)

  • Conditional Rendering - Dynamic UI based on state
  • Props Combination - Grouping related props for cleaner APIs
  • React Hooks - Modern state management and side effects
  • Presentational & Container - Separating UI from business logic
  • Slots Pattern - Flexible component composition

๐Ÿฅˆ Silver Level (Intermediate)

  • Compound Components - Building flexible, composable APIs
  • Controlled Components - Managing form state externally
  • Uncontrolled Components - Letting components manage their own state
  • FACC Pattern - Function as Child Components
  • Render Children - Advanced component composition
  • Render Props - Sharing logic between components
  • Provider Pattern - Global state management with Context
  • State Reducer - Complex state logic management
  • Portals - Rendering outside component hierarchy
  • Polymorphic Components - Flexible component APIs

๐Ÿฅ‡ Gold Level (Advanced)

  • Higher Order Components - Component enhancement and reuse
  • Suspense & Lazy Loading - Code splitting and async components
  • Headless Components - Logic without UI for maximum flexibility

๐Ÿ› ๏ธ Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn

Installation

# Clone the repository
git clone https://github.com/code-mattclaffey/react-design-patterns.git

# Navigate to project
cd react-design-patterns

# Install dependencies
npm install

# Start Storybook (recommended)
npm run storybook

# Or start development server
npm run dev

Using Storybook (Recommended)

The course is designed to be experienced through Storybook:

npm run storybook

Navigate through the lessons in the sidebar:

  1. Introduction - Course overview and setup
  2. Lessons - Interactive exercises organized by difficulty
  3. Each lesson includes:
    • Theory and examples
    • Exercise files with guided tasks
    • Final implementations
    • When to use each pattern

๐Ÿ“ Project Structure

src/
โ”œโ”€โ”€ course/
โ”‚   โ”œโ”€โ”€ 01-introduction/          # Course welcome and overview
โ”‚   โ””โ”€โ”€ 02-lessons/
โ”‚       โ”œโ”€โ”€ 01-Bronze/            # Fundamental patterns
โ”‚       โ”œโ”€โ”€ 02-Silver/            # Intermediate patterns
โ”‚       โ””โ”€โ”€ 03-Gold/              # Advanced patterns
โ”œโ”€โ”€ shared/
โ”‚   โ”œโ”€โ”€ components/               # Reusable UI components
โ”‚   โ”œโ”€โ”€ hooks/                    # Custom React hooks
โ”‚   โ””โ”€โ”€ modules/                  # Business logic modules
config/                           # Build and linting configuration

๐ŸŽฏ Learning Approach

Each lesson follows a consistent structure:

  1. Problem Introduction - Real-world scenario
  2. Pattern Explanation - Theory with code examples
  3. Hands-on Exercise - Guided implementation
  4. Final Solution - Complete working example
  5. When to Use - Practical guidance for real projects

๐Ÿงช Available Scripts

# Development
npm run dev              # Start Vite dev server
npm run storybook        # Start Storybook (recommended)

# Building
npm run build            # Build for production
npm run build-storybook  # Build Storybook for deployment

# Quality
npm run lint             # Run ESLint
npm run test             # Run Storybook tests

๐Ÿค Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Follow the existing code style
  4. Add tests for new patterns
  5. Submit a pull request

๐Ÿ“ Feedback

Found an issue or have suggestions? Please open an issue on GitHub.

๐Ÿ“„ License

This project is open source and available under the MIT License.


Happy learning! ๐Ÿš€ Start your React design patterns journey with npm run storybook