Book Image

React Cookbook

By : Carlos Santana Roldán
Book Image

React Cookbook

By: Carlos Santana Roldán

Overview of this book

React.js is Facebook's dynamic frontend web development framework. It helps you build efficient, high-performing web applications with an intuitive user interface. With more than 66 practical and self-contained tutorials, this book examines common pain points and best practices for building web applications with React. Each recipe addresses a specific problem and offers a proven solution with insights into how it works, so that you can modify the code and configuration files to suit your requirements. The React Cookbook starts with recipes for installing and setting up the React.js environment with the Create React Apps tool. You’ll understand how to build web components, forms, animations, and handle events. You’ll then delve into Redux for state management and build amazing UI designs. With the help of practical solutions, this book will guide you in testing, debugging, and scaling your web applications, and get to grips with web technologies like WebPack, Node, and Firebase to develop web APIs and implement SSR capabilities in your apps. Before you wrap up, the recipes on React Native and React VR will assist you in exploring mobile development with React. By the end of the book, you will have become familiar with all the essential tools and best practices required to build efficient solutions on the web with React.
Table of Contents (17 chapters)
15
Most Common React Interview Questions

Introduction

React typically uses client-side rendering (CSR). This means that it dynamically injects the HTML code in the target div (it generally uses the #app or #root IDs), and that's why if you try to see the page's code directly (right-click—View Page Code) you will see something like this:

The only way to see the actual code is by inspecting the site with Chrome Dev Tools, or other tools, and here is the code generated by React using CSR:

By inspecting the page, you can see the code that is injected into our #root div. Server-side rendering (SSR) is very useful for improving the SEO of our website and be indexed by the main search engines, such as Google, Yahoo, and Bing. You probably don't need to worry about SSR if you don't care too much about SEO. Currently, the Googlebot supports CSR, and it can index our site on...