Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Lydia Hallie, Addy Osmani, Josh W. Comeau

Rating 3.5 AI initial rating

In this book, you will learn design patterns, performance and rendering patterns for building high-quality web applications using modern JavaScript and React. Patterns are time-tested templates for writing code. They can be really powerful, whether you're a seasoned developer or beginner, bringing a valuable level of resilience and flexibility to your codebase. Whether it's better user-experience, developer-experience or just smarter architecture, the patterns in “Learning Patterns” can be a valuable consideration for any modern web application.

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A practical field guide to the design, rendering, and performance patterns that make modern JavaScript and React applications resilient, maintainable, and fast. Best suited to front-end developers who already write React and want a structured vocabulary for the architectural decisions they make every day. 【Book Arc】 - **Opening (~0%–11%)**: Frames the book's premise—patterns as reusable templates—and lays the React groundwork (components, props, state, lifecycle, componentization) before introducing classic patterns like Singleton and the pitfalls of global mutable state. - **Early (~11%–28%)**: Walks through core JavaScript and React design patterns—Prototype, Container/Presentational, Observer, module exports/imports, Mixins, Mediator, and Render Props—each tied to a concrete UI example. - **Middle (~28%–44%)**: Transitions from component-level patterns into Hooks (useState, sharing non-visual logic, HOC composition), then pivots to rendering strategy: a history of web rendering and the trade-offs behind CSR, SSR, static generation, and Next.js data fetching. - **Late (~44%–61%)**: Deepens the performance and rendering material—JavaScript budgeting and preloading for CSR, incremental static regeneration, progressive hydration requirements, streaming rendering, and React 18's fixes for SSR pain points. - **Ending (~61%+)**: Moves into applied optimization, using bundle-size case studies (replacing heavy dependencies with lean custom components) to show how pattern choices translate into measurable performance wins. 【Key Takeaways】 - **Patterns are decision templates, not recipes** (Opening): The book treats patterns as time-tested structures that add resilience and flexibility, framing them as considerations rather than mandates—useful whether you're a beginner or veteran. - **React rewards modular thinking** (Opening): Componentization—designing individual components before assembling pages—maps naturally onto design systems, and the Avatar/Comment extraction example shows why generic props (`user` over `author`) keep components reusable. - **Global mutable state is a trap** (Early): The Singleton discussion contrasts mutable global state with React's read-only state tools (Redux, Context), warning that execution order and data flow get treacherous as apps grow. - **Separate *what* from *how*** (Early): Container/Presentational and the `useDogImages` hook demonstrate enforcing separation of concerns—logic fetches data, presentational components only render it. - **Hooks solved a real gap** (Middle): Before Hooks, React had no clean way to share non-visual logic, which spawned HOC and Render Prop complexity; Hooks extract stateful logic into plain functions—but demand discipline around rules, `useEffect`, and misuse of `useCallback`/`useMemo`. - **Rendering strategy is a performance decision** (Middle): CSR, SSR, static generation, hydration, and progressive rendering carry distinct implications; the Chrome team's push toward static/SSR over full rehydration reflects a balance of performance and feature delivery. - **Budget and defer JavaScript** (Late): For CSR, performance is inversely proportional to bundle size—target roughly 100–170KB initial gzipped bundles, preload critical resources, and load features on demand. - **Progressive hydration must not block input** (Late): Activating the app in chunks works only if already-hydrated sections stay interactive, with code-splitting and loading indicators supporting deferred hydration. 【Reading Tips】 - **Skim the React primer if you're experienced**: The opening lifecycle and componentization material is foundational; jump to the pattern chapters if you already know React well. - **Deep-read the rendering section (~39%–61%)**: This is the book's densest and most decision-relevant stretch—take notes on when each rendering pattern fits, since the trade-offs are easy to conflate. - **Treat Hooks caveats as a checklist**: The warnings about `useEffect` practice time and `useMemo`/`useCallback` misuse are worth revisiting against your own codebase. - **Follow the bundle case studies closely**: The burger-menu replacement (6.73 kB → 879 B gzipped) shows the payoff of pattern-driven optimization better than any abstract advice. - **Carry away a vocabulary, not code snippets**: The lasting value is naming patterns so your team can discuss architecture precisely. 【Coverage Limits】 The excerpts cover design patterns, Hooks, and rendering/performance material well, but the ending chapters and any later pattern categories are only partially represented; specific chapter titles and the full pattern roster are not confirmed by the excerpts.
Page 8
t can, perfectly map to the elements of your design system. So, in essence, designing for React actually rewards you for thinking in a modular way. It allows...
View in text
Excerpt 2
ccurs, the logger and toastify functions will get notified. Now we just need to implement the functions that actually notify the observable: the handleClick ...
View in text
Excerpt 3
se state, and other React features without writing a class. With React, you can always reuse stateful logic without the need to rewrite the code over and ove...
View in text
Excerpt 4
he following directive in the <head> section of the HTML 
 This informs the browser to start loading the critical.js file before the page rendering mechanism...
View in text
Excerpt 5
not block user input on chunks that are already hydrated.\ • Allows usage of some sort of a loading indicator for chunks with deferred hydration. 
 
 
 2. Co...
View in text
Excerpt 6
a static site builder that can generate lightweight static HTML pages from UI components built in other frameworks such as React, Preact, Svelte, Vue, and ot...
View in text
Excerpt 7
e'll only import it when we want to show the EmojiPicker. An easy way to dynamically import components in React is by using React Suspense. The React.Suspens...
View in text
Excerpt 8
y visited can be dynamically imported. webpack.config.js 
 Webpack 4.6.0+ allows preloading of resources by adding 
 /* webpackPreload: true */ to the import...
View in text
Tags
AI categories
JavaScriptWeb TechnologySoftware
Publisher: eBook
Publish Year: 2021
Language: English
Pages: 436
File Format: PDF
File Size: 18.0 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…