This Book
- Recommended Resources
- Recommended Books
Getting Started
- Try React
- Learn React
- Staying Informed
- Versioned Documentation
- Something Missing?
Add React to a Website
- Add React in One Minute
- Optional: Try React with JSX
Create a New React App
- You Might Not Need a Toolchain
- Recommended Toolchains
- Creating a Toolchain from Scratch
CDN Links
Release Channels
Hello World
- How to Read This Guide
- Knowledge Level Assumptions
- Let’s Get Started!
Introducing JSX
Rendering Elements
- Rendering an Element into the DOM
- Updating the Rendered Element
- React Only Updates What’s Necessary
Components and Props
- Function and Class Components
- Rendering a Component
- Composing Components
- Extracting Components
- Props are Read-Only
State and Lifecycle
- Converting a Function to a Class
- Adding Local State to a Class
- Adding Lifecycle Methods to a Class
- Using State Correctly
- The Data Flows Down
Handling Events
- Passing Arguments to Event Handlers
Conditional Rendering
Lists and Keys
- Keys
Forms
- Controlled Components
- The textarea Tag
- The select Tag
- The file input Tag
- Handling Multiple Inputs
- Controlled Input Null Value
- Alternatives to Controlled Components
- Fully-Fledged Solutions
Lifting State Up
- Adding a Second Input
- Writing Conversion Functions
- Lifting State Up
- Lessons Learned
Composition vs Inheritance
- Containment
- Specialization
- So What About Inheritance?
Thinking in React
- Start With A Mock
- Step 1: Break The UI Into A Component Hierarchy
- Step 2: Build A Static Version in React
- Step 3: Identify The Minimal (but complete) Representation Of UI State
- Step 4: Identify Where Your State Should Live
- Step 5: Add Inverse Data Flow
- And That’s It
Accessibility
- Why Accessibility?
- Standards and Guidelines
- Semantic HTML
- Accessible Forms
- Focus Control
- Mouse and pointer events
- More Complex Widgets
- Other Points for Consideration
- Development and Testing Tools
Code Splitting
- Bundling
- Code Splitting
import()React.lazy- Route-based code splitting
- Named Exports
Context
- When to Use Context
- Before You Use Context
- API
- Examples
- Caveats
- Legacy API
Error Boundaries
- Introducing Error Boundaries
- Live Demo
- Where to Place Error Boundaries
- New Behavior for Uncaught Errors
- Component Stack Traces
- How About try/catch?
- How About Event Handlers?
- Naming Changes from React 15
Forwarding Refs
- Forwarding refs to DOM components
- Note for component library maintainers
- Forwarding refs in higher-order components
- Displaying a custom name in DevTools
Fragments
- Motivation
- Usage
Higher Order Components
- Use HOCs For Cross-Cutting Concerns
- Don’t Mutate the Original Component. Use Composition.
- Convention: Pass Unrelated Props Through to the Wrapped
- Convention: Maximizing Composability
- Convention: Wrap the Display Name for Easy Debugging
- Caveats
Integrating with Other Libraries
- Integrating with DOM Manipulation Plugins
- Integrating with Other View Libraries
- Integrating with Model Layers
JSX In Depth
- Specifying The React Element Type
- Props in JSX
- Children in JSX
Optimizing Performance
- Use the Production Build
- Profiling Components with the Chrome Performance Tab
- Profiling Components with the DevTools Profiler
- Virtualize Long Lists
- Avoid Reconciliation
- shouldComponentUpdate In Action
- Examples
- The Power Of Not Mutating Data
Portals
- Usage
- Event Bubbling Through Portals
Profiler API
- Usage
onRenderCallback
React Without ES6
- Declaring Default Props
- Setting the Initial State
- Autobinding
- Mixins
React Without JSX
Reconciliation
- Motivation
- The Diffing Algorithm
- Tradeoffs
Refs and the DOM
Render Props
- Use Render Props for Cross-Cutting Concerns
- Using Props Other Than
render - Caveats
Static Type Checking
- Flow
- TypeScript
- Reason
- Kotlin
- Other Languages
Strict Mode
Typechecking With PropTypes
Uncontrolled Components
- The file input Tag
Web Components
- Using Web Components in React
- Using React in your Web Components
React Top-Level API
- Overview
- Reference
React Component
- Overview
- Reference
- Other APIs
- Class Properties
- Instance Properties
ReactDOM
- Overview
- Reference
ReactDOMServer
- Overview
- Reference
DOM Elements
- Differences In Attributes
- All Supported HTML Attributes
SyntheticEvent
- Overview
- Supported Events
- Reference
Test Utilities
- Overview
- Reference
- Other Utilities
Test Renderer
- Overview
- Reference
- Ideas
JavaScript Environment Requirements
Glossary of React Terms
- Single-page Application
- ES6, ES2015, ES2016, etc
- Compilers
- Bundlers
- Package Managers
- CDN
- JSX
- Elements
- Components
- Lifecycle Methods
- Keys
- Refs
- Events
- Reconciliation
Introducing Hooks
- Video Introduction
- No Breaking Changes
- Motivation
- Gradual Adoption Strategy
- Frequently Asked Questions
- Next Steps
Hooks at a Glance
- State Hook
- Effect Hook
- Rules of Hooks
- Building Your Own Hooks
- Other Hooks
- Next Steps
Using the State Hook
- Equivalent Class Example
- Hooks and Function Components
- What’s a Hook?
- Declaring a State Variable
- Reading State
- Updating State
- Recap
- Next Steps
Using the Effect Hook
- Effects Without Cleanup
- Effects with Cleanup
- Recap
- Tips for Using Effects
- Next Steps
Rules of Hooks
- ESLint Plugin
- Explanation
- Next Steps
Building Your Own Hooks
- Extracting a Custom Hook
- Using a Custom Hook
useYourImagination()
Hooks API Reference
- Basic Hooks
- Additional Hooks
Hooks FAQ
- Adoption Strategy
- From Classes to Hooks
- Performance Optimizations
- Under the Hood
Testing Overview
Testing Recipes
Testing Environments
Introducing Concurrent Mode (Experimental)
- What Is Concurrent Mode?
- Blocking vs Interruptible Rendering
- Putting Research into Production
- Next Steps
Suspense for Data Fetching (Experimental)
- What Is Suspense, Exactly?
- Using Suspense in Practice
- Traditional Approaches vs Suspense
- Start Fetching Early
- Suspense and Race Conditions
- Handling Errors
- Next Steps
Concurrent UI Patterns (Experimental)
- Transitions
- The Three Steps
- Other Patterns
- Next Steps
Adopting Concurrent Mode (Experimental)
- Installation
- What to Expect
Concurrent Mode API Reference (Experimental)
- Enabling Concurrent Mode
- Suspense API
