Preface
Introduction
Why Comic Strips ?
Why Reintroduce React ?
What’s Changed since version 16?
Chapter 1: New Lifecycle Methods.
What’s Lifecycle Anyway.
Lifecycle Methods.
static getDerivedStateFromProps.
getSnapshotBeforeUpdate.
The Error Handling Lifecycle Methods.
static getDerivedStateFromError.
componentDidCatch.
Conclusion.
Chapter 2: Simpler State Management with the Context API.
Introduction to Context.
Example: The Mini-Bank Application.
Identifying Props being Drilled.
Avoid Props Drilling with Context.
Isolating Implementation Details.
Updating Context Values.
Conclusion.
Chapter 3: ContextType — Using Context without a Consumer.
Using a Class Component with contextType.
The Perfect Solution?
Conclusion
Chapter 4: React.memo === Functional PureComponent.
How React.memo works.
Handling Deeply Nested Props.
Conclusion.
Chapter 5: The Profiler — Identifying Performance Bottlenecks.
Measuring Performance in React Apps.
Getting Started.
How does the Profiler Work?
Making Sense of the Profiler Results.
The Flame Chart.
The Ranked Chart.
Component Chart.
Interactions.
Example: Identifying Performance BottleNecks in the Bank Application.
Noting the Expected Behaviour.
Interpreting the Flame chart.
Profile Different Interactions.
The Provider Value.
Conclusion.
Chapter 6: Lazy Loading with React.Lazy and Suspense.
What is Lazy Loading?
Using React.lazy and Suspense.
Handling Errors.
No named exports.
Code splitting routes.
Example: Adding Lazy Loading to the Bank App.
Conclusion.
Chapter 7: Hooks — Building Simpler React Apps.
Introducing Hooks.
The Candy Bowl.
The State Hook.
Multiple useState calls.
Object as Initial Values
The Effect Hook.
Passing Array Dependencies.
Build Your own Hooks
The Rules of Hooks
Advanced Hooks
Chapter 8: Advanced React Patterns with Hooks
Introduction
Why Advanced Patterns?
Compound Components Pattern
Example: Building an Expanding Component.
Designing the API
Building the Expandable Component
Building the Compound Child Components
Manageable Styling for Reusable Components
Building a Custom Hook
Props Collection
Prop Getters
State Initializers
State Reducer
Control Props
Conclusion