Learning React, 2nd Edition

Book Description

If you want to learn how to build efficient React applications, this is your book. Ideal for web developers and software engineers who understand how JavaScript, CSS, and HTML work in the browser, this updated edition provides best practices and patterns for writing modern React code. No prior knowledge of React or functional JavaScript is necessary.

With their learning road map, authors Alex Banks and Eve Porcello show you how to create UIs that can deftly display changes without page reloads on large-scale, data-driven websites. You’ll also discover how to work with functional programming and the latest ECMAScript features. Once you learn how to build React components with this hands-on guide, you’ll understand just how useful React can be in your organization.

    Understand key functional programming concepts with JavaScriptLook under the hood to learn how React runs in the browserCreate application presentation layers with React componentsManage data and reduce the time you spend debugging applicationsIncorporate React Hooks to manage state and fetch dataUse a routing solution for single-page application featuresLearn how to structure React applications with servers in mind

Table of Contents

  1. Preface
    1. Conventions Used in This Book
    2. Using Code Examples
    3. O’Reilly Online Learning
    4. How to Contact Us
    5. Acknowledgments
  2. 1. Welcome to React
    1. A Strong Foundation
    2. React’s Past and Future
      1. Learning React: Second Edition Changes
    3. Working with the Files
      1. File Repository
      2. React Developer Tools
      3. Installing Node.js
  3. 2. JavaScript for React
    1. Declaring Variables
      1. The const Keyword
      2. The let Keyword
      3. Template Strings
    2. Creating Functions
      1. Function Declarations
      2. Function Expressions
      3. Default Parameters
      4. Arrow Functions
    3. Compiling JavaScript
    4. Objects and Arrays
      1. Destructuring Objects
      2. Destructuring Arrays
      3. Object Literal Enhancement
      4. The Spread Operator
    5. Asynchronous JavaScript
      1. Simple Promises with Fetch
      2. Async/Await
      3. Building Promises
    6. Classes
    7. ES6 Modules
      1. CommonJS
  4. 3. Functional Programming with JavaScript
    1. What It Means to Be Functional
    2. Imperative Versus Declarative
    3. Functional Concepts
      1. Immutability
      2. Pure Functions
      3. Data Transformations
      4. Higher-Order Functions
      5. Recursion
      6. Composition
      7. Putting It All Together
  5. 4. How React Works
    1. Page Setup
    2. React Elements
    3. ReactDOM
      1. Children
    4. React Components
      1. React Components: A Historical Tour
  6. 5. React with JSX
    1. React Elements as JSX
      1. JSX Tips
      2. Mapping Arrays with JSX
    2. Babel
    3. Recipes as JSX
    4. React Fragments
    5. Intro to webpack
      1. Creating the Project
      2. Loading the Bundle
      3. Source Mapping
      4. Create React App
  7. 6. React State Management
    1. Building a Star Rating Component
    2. The useState Hook
    3. Refactoring for Advanced Reusability
    4. State in Component Trees
      1. Sending State Down a Component Tree
      2. Sending Interactions Back up a Component Tree
    5. Building Forms
      1. Using Refs
      2. Controlled Components
      3. Creating Custom Hooks
      4. Adding Colors to State
    6. React Context
      1. Placing Colors in Context
      2. Retrieving Colors with useContext
      3. Stateful Context Providers
      4. Custom Hooks with Context
  8. 7. Enhancing Components with Hooks
    1. Introducing useEffect
      1. The Dependency Array
      2. Deep Checking Dependencies
      3. When to useLayoutEffect
      4. Rules to Follow with Hooks
      5. Improving Code with useReducer
      6. useReducer to Handle Complex State
      7. Improving Component Performance
      8. shouldComponentUpdate and PureComponent
      9. When to Refactor
  9. 8. Incorporating Data
    1. Requesting Data
      1. Sending Data with a Request
      2. Uploading Files with fetch
      3. Authorized Requests
      4. Saving Data Locally
      5. Handling Promise States
    2. Render Props
    3. Virtualized Lists
      1. Creating a Fetch Hook
      2. Creating a Fetch Component
      3. Handling Multiple Requests
      4. Memozing Values
      5. Waterfall Requests
      6. Throttling the Network Speed
      7. Parallel Requests
      8. Waiting for Values
      9. Canceling Requests
    4. Introducing GraphQL
      1. GitHub GraphQL API
      2. Making a GraphQL Request
  10. 9. Suspense
    1. Error Boundaries
    2. Code Splitting
      1. Introducing: The Suspense Component
      2. Using Suspense with Data
      3. Throwing Promises
      4. Building Suspenseful Data Sources
      5. Fiber
  11. 10. React Testing
    1. ESLint
      1. ESLint Plug-Ins
    2. Prettier
      1. Configuring Prettier by Project
      2. Prettier in VSCode
    3. Typechecking for React Applications
      1. PropTypes
      2. Flow
      3. TypeScript
    4. Test-Driven Development
      1. TDD and Learning
    5. Incorporating Jest
      1. Create React App and Testing
    6. Testing React Components
      1. Queries
      2. Testing Events
      3. Using Code Coverage
  12. 11. React Router
    1. Incorporating the Router
    2. Router Properties
      1. Nesting Routes
    3. Using Redirects
      1. Routing Parameters
  13. 12. React and the Server
    1. Isomorphic Versus Universal
      1. Client and Server Domains
    2. Server Rendering React
    3. Server Rendering with Next.js
    4. Gatsby
    5. React in the Future
  14. Index

Product Information

  • Title: Learning React, 2nd Edition
  • Author(s): Alex Banks, Eve Porcello
  • Release date: June 2020
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781492051725