Limit search to available items
Book Cover
E-book
Author Larsen, John R., author.

Title React Hooks in action with suspense and concurrent mode / John Larsen
Published Shelter Island, NY : Manning Publications, [2021]
©2021

Copies

Description 1 online resource
Contents Intro -- React Hooks in Action -- Copyright -- dedication -- contents -- front matter -- preface -- acknowledgments -- about this book -- Who should read this book -- How this book is organized: A roadmap -- About the code -- liveBook discussion forum -- Other online resources -- about the author -- about the cover illustration -- Part 1 -- 1 React is evolving -- 1.1 What is React? -- 1.1.1 Building a UI from components -- 1.1.2 Synchronizing state and UI -- 1.1.3 Understanding component types -- 1.2 What's new in React? -- 1.3 React Hooks can add state to function components
1.3.1 Stateful function components: Less code, better organization -- 1.3.2 Custom hooks: Easier code reuse -- 1.3.3 Third-party hooks provide ready-made, well-tested functionality -- 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 Whom is this book for? -- 1.7 Getting started -- Summary -- 2 Managing component state with the useState hook -- 2.1 Setting up the bookings manager app -- 2.1.1 Generating the app skeleton with create-react-app -- 2.1.2 Editing the four key files
2.1.3 Adding a database file for the application -- 2.1.4 Creating page components and a UserPicker.js file -- 2.2 Storing, using, and setting values with useState -- 2.2.1 Assigning new values to variables doesn't update the UI -- 2.2.2 Calling useState returns a value and an updater function -- 2.2.3 Calling the updater function replaces the previous state value -- 2.2.4 Passing a function to useState as the initial value -- 2.2.5 Using the previous state when setting the new state -- 2.3 Calling useState multiple times to work with multiple values -- 2.3.1 Using a drop-down list to set state
2.3.2 Using a check box to set state -- 2.4 Reviewing some function component concepts -- Summary -- 3 Managing component state with the useReducer hook -- 3.1 Updating multiple state values in response to a single event -- 3.1.1 Taking users out of the movie with unpredictable state changes -- 3.1.2 Keeping users in the movie with predictable state changes -- 3.2 Managing more complicated state with useReducer -- 3.2.1 Updating state using a reducer with a predefined set of actions -- 3.2.2 Building a reducer for the BookablesList component
3.2.3 Accessing component state and dispatching actions with useReducer -- 3.3 Generating the initial state with a function -- 3.3.1 Introducing the WeekPicker component -- 3.3.2 Creating utility functions to work with dates and weeks -- 3.3.3 Building the reducer to manage dates for the component -- 3.3.4 Passing an initialization function to the useReducer hook -- 3.3.5 Updating BookingsPage to use WeekPicker -- 3.4 Reviewing some useReducer concepts -- Summary -- 4 Working with side effects -- 4.1 Exploring the useEffect API with simple examples -- 4.1.1 Running side effects after every render
Summary Get started with React Hooks and you'll soon have code that's better organized and easier to maintain. React Hooks are targeted JavaScript functions that let you reuse and share functionality across components. Use them to split components into smaller functions, manage state and side effects, and access React features without classes-- all without having to rearrange your component hierarchy. React Hooks in action teaches you to write fast and reusable React components using Hooks. You'll start by learning to create component code with Hooks. Next, you'll implement a resource booking application that demonstrates managing local state, application state, and side effects like fetching data. Code sample and illustrations make learning Hooks easy
Subject JavaScript (Computer program language)
Web-based user interfaces -- Design and construction
Application software -- Development.
Web site development.
Application software -- Development.
JavaScript (Computer program language)
Web site development.
Form Electronic book
ISBN 9781638350767
1638350760