Welcome to Manning India!

We are pleased to be able to offer regional eBook pricing for Indian residents.
All eBook prices are discounted 40% or more!
React Hooks in Action
With Suspense and Concurrent Mode
John Larsen
  • MEAP began February 2020
  • Publication in Fall 2020 (estimated)
  • ISBN 9781617297632
  • 250 pages (estimated)
  • printed in black & white
Build stylish, slick, and speedy-to-load user interfaces in React without writing custom classes. React Hooks are a new category of functions that help you to manage state, lifecycle and side effects within functional components. React Hooks in Action teaches you to use pre-built hooks like useState, useReducer and useEffect, and to build your own hooks. Your code will be more reusable, require less boilerplate, and you’ll instantly be a more effective React developer.
Table of Contents detailed table of contents

Part 1: The React Roadmap

1 Evolving React

1.1 What is React?

1.1.1 Building a UI from components

1.1.2 React synchronizes state and UI

1.1.3 Component Types

1.2 What’s new in React?

1.3 Stateful Functional Components with React Hooks

1.3.1 Less code, better organization

1.3.2 Custom Hooks: Easier code reuse

1.3.3 Third party Hooks: It’s good to share

1.4 Better UX with Concurrent Mode and Suspense

1.4.1 Concurrent Mode

1.4.2 Suspense

1.5 React’s new publication channels

1.6 Who is this book for?

1.7 Getting started

2 Making your code shorter and simpler

Part 2: React Hooks

3 Managing component state

3.1 A bookings manager: setting up the App

3.1.1 Bookings app project structure

3.1.2 Four files that won’t change

3.2 Storing, using and setting values with useState

3.2.1 Assigning new values to variables doesn’t update the UI

3.2.2 Calling useState returns a value and an updater function

3.2.3 Passing a function to the updater function

3.2.4 Call useState multiple times to track and update multiple values

3.3 Managing more complicated state with useReducer

3.3.1 A reducer updates state using a pre-defined set of actions

3.3.2 Building a reducer for the Bookables component

3.3.3 Access component state and dispatch actions with useReducer

3.4 Avoiding re-rendering with useRef

3.4.1 Using refs to persist values across renders

3.4.2 Keeping references to DOM elements

3.5 Summary

4 Managing application state

4.1 Lifting state and passing it down

4.1.1 The UI can directly access local state in functional components

4.1.2 Lifting state up to the parent and passing it down via props

4.2 Avoiding expensive re-computations when state changes

4.2.1 Calling the useMemo hook

4.2.2 Memoizing an ‘expensive’ computation

4.2.3 Using the memoized function to build a grid of bookings

4.3 Providing and consuming state with The React Context API

4.3.1 Five steps for providing and consuming state

4.3.2 Seeing the Context API in action

4.4 Summary

5 Working with side effects

6 Encapsulating code with custom hooks

Part 3: Suspense and Concurrent Mode

7 Managing the user experience with Suspense

8 Managing the user experience with Concurrent Mode

Part 4: Example App

9 Introducing GraphQL and Apollo hooks


Appendix A: A The classic React approach - a comparison

About the Technology

React Hooks promise to make React programmers even more productive. Hooks are a collection of pre-built and custom functions that give you a simpler API for working with key React functionalities. Hooks cleanly encapsulate side effects, make it easier to reuse components between projects, and result in less code overall. These new features represent a fundamental evolution in how the React library functions, so even experienced React developers will want to get up to speed with Hooks.

About the book

React Hooks in Action shows you how to use Hooks to make your codebase simpler and more reusable, and your applications faster and more responsive. You’ll build a resource booking example application chapter by chapter, learning how to develop components with local, shared, and application states. You’ll discover different approaches to data fetching, including using Concurrent Mode and Suspense to improve user experience, and explore third party hooks in the evolving React ecosystem.

What's inside

  • Create a Redux store and interact with it via Hooks
  • Use code-splitting to improve the responsiveness of your apps
  • Build functional components that can update their own state
  • Manage component side effects
  • Use the React Suspense API to improve the user experience of page and data loading

About the reader

For front-end web developers experienced with React.

About the author

John Larsen is the author of Get Programming with JavaScript. He was a mathematics and computing teacher for 25 years. He has an MA in mathematics and an MSc in information technology, and an ongoing interest in educational research. A web developer since 2000, he uses JavaScript end-to-end for server-side and client-side programming.

Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
MEAP combo $39.99 pBook + eBook + liveBook
MEAP eBook $31.99 pdf + ePub + kindle + liveBook
Prices displayed in rupees will be charged in USD when you check out.

placing your order...

Don't refresh or navigate away from the page.

FREE domestic shipping on three or more pBooks