Library
Learning Patterns
UI/UX Design

Learning Patterns

Lydia Hallie & Addy Osmani 2022 12 references

Modern JavaScript and React design patterns, rendering strategies, and performance optimization techniques from Lydia Hallie and Addy Osmani's Learning Patterns.

javascript react design-patterns web-performance rendering-patterns next-js core-web-vitals

Overview

The Core Framework

  • Classical design patterns must be re-evaluated for modern JS/React — many are obsolete or replaced by Hooks and ES modules
  • Pattern selection spans three layers: design (code organization), rendering (content delivery), performance (user experience optimization)
  • React Hooks are the universal simplifier — replacing HOCs, render props, container components, and class-based state
  • Rendering is a spectrum (CSR → SSR → SSG → iSSG → Islands), not a binary choice — pick based on metric priorities
  • Always measure before and after — some "optimizations" cause regressions

Quick Lookup

Situation Do This Avoid This
Sharing state across tree Provider Pattern (Context API) Prop drilling through intermediaries
Cross-cutting logic (logging, auth) Custom Hook HOC wrapper (unless uniform enforcement needed)
Global singleton state ES module + Object.freeze Singleton class pattern
Content-heavy site, rare updates SSG or iSSG Full SSR on every request
Interactive app, personalized data CSR or SSR SSG (stale content risk)
Mostly static, few interactive widgets Islands Architecture Full-page hydration
Large list (1000+ items) List virtualization (react-window) Rendering all DOM nodes
Heavy 3P widget (chat, auth) Facade pattern + import on interaction Eager loading in initial bundle
Late-discovered critical resource <link rel="preload"> Relying on natural discovery
Anticipated future navigation <link rel="prefetch"> Over-prefetching (bandwidth waste)

The Key Insight

"There is such a gap between how patterns were designed for classical OOP and how JavaScript actually works that many patterns become anti-patterns when applied without adaptation." — Hallie & Osmani, Introduction

References