React Cookbook

React Cookbook

This book contains a collection of code that we’ve found helpful over several years of building React applications. Like recipes you would use in the kitchen, we’ve designed them to be starting points or inspirations for your own code.

React helps you create and work on an app in just a few minutes. But learning how to put all the pieces together is hard. How do you validate a form? Or implement a complex multistep user action without writing messy code? How do you test your code? Make it reusable? Wire it to a backend? Keep it easy to understand? The React Cookbook delivers answers fast.

Many books teach you how to get started, understand the framework, or use a component library with React, but very few provide examples to help you solve particular problems. This easy-to-use cookbook includes the example code developers need to unravel the most common problems when using React, categorized by topic area and problem.

From the Preface

This book contains a collection of code that we’ve found helpful over several years of building React applications. Like recipes you would use in the kitchen, we’ve designed them to be starting points or inspirations for your own code. You should adjust them to match your situation and replace any ingredients (such as example servers) with those that seem more appropriate for your needs. The recipes range from general web development tips to larger pieces of code that you could generalize into libraries.

Most of the recipes are built with Create React App, as this is now the common starting point for most React projects. It should be straightforward to convert each recipe for use in Preact or Gatsby.

To keep the code compact, we have generally used hooks and functions rather than class components. We have also used the Prettier tool to apply standard code formatting throughout. We have used Prettier’s default options, other than narrower indents and line lengths, to fit the code neatly onto the printed page. You should adjust the code format to match your preferred standard.

You’ll learn how to:

  • Build a single-page application in React using a rich UI
  • Create progressive web applications that users can install and work with offline
  • Integrate with backend services such as REST and GraphQL
  • Automatically test for accessibility problems in your application
  • Secure applications with fingerprints and security tokens using WebAuthn
  • Deal with bugs and avoid common functional and performance problems

More about the authors

David Griffiths, David Griffiths has been writing code professionally in React for five years, and has created applications for startups, retail stores, vehicle manufacturers, national sports bodies and large software vendors. He has over 10 years experience in writing JavaScript.

Dawn Griffiths, Dawn Griffiths has over 20 years experience working in the IT industry, working as a senior developer and senior software architect. She has written various books in the Head First series, including Head First Android Development (1e and 2e) and Head First Kotlin, and developed The Agile Sketchpad animated video series with David.

All content is for demonstration purposes, we do not store files, please purchase the printed version of the magazine after reading.

There are many ads here. Please keep in mind that readnote.org is 100% free. Ads are keeping this site alive. If you use, please make an exception and disable any ads blocking system.

Extraction code:(9l8p)