A comprehensive interactive course teaching React design patterns through Pokemon-themed examples. Learn advanced React patterns with hands-on exercises and real-world applications.
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
- 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
- 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
- Higher Order Components - Component enhancement and reuse
- Suspense & Lazy Loading - Code splitting and async components
- Headless Components - Logic without UI for maximum flexibility
- Node.js 18+
- npm or yarn
# 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
The course is designed to be experienced through Storybook:
npm run storybook
Navigate through the lessons in the sidebar:
- Introduction - Course overview and setup
- Lessons - Interactive exercises organized by difficulty
- Each lesson includes:
- Theory and examples
- Exercise files with guided tasks
- Final implementations
- When to use each pattern
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
Each lesson follows a consistent structure:
- Problem Introduction - Real-world scenario
- Pattern Explanation - Theory with code examples
- Hands-on Exercise - Guided implementation
- Final Solution - Complete working example
- When to Use - Practical guidance for real projects
# 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
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Follow the existing code style
- Add tests for new patterns
- Submit a pull request
Found an issue or have suggestions? Please open an issue on GitHub.
This project is open source and available under the MIT License.
Happy learning! 🚀 Start your React design patterns journey with npm run storybook