Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Enrique Pablo Molinari

Rating No ratings yet

Includes: React Hooks and React Router + Full Stack Authentication & Authorization Every successful framework or library provides something unique which gives developers a new tool for writing better software. In the case of React, that tool is called component. You might be thinking that you have been reading about components as the solution to your spaghetti software nightmare for the last 15 years without any success. You are not wrong. However, React is an exception. It provides the constructions and tools to build highly cohesive components to assemble your next application. In this book, we will study React core concepts, to end up being very practical describing how to split an application into components and to fully implement it. We explain the concepts creating three applications. We use React Material UI for the CRUD application, React Router v6 and a HTML theme to implement a Blog and React Bootstrap to implement a Task List application.

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A hands-on introduction to React that treats the component as the central unit of design, walking you from JavaScript fundamentals to three fully built applications. Best for developers who know some JavaScript and want a practical, project-driven path into React, Hooks, routing, and auth. 【Book Arc】 - **Opening (~0%–10%)**: Frames the book's thesis — the component is React's unique contribution — and previews the three applications (CRUD, Blog, Task List) that anchor the practical work. - **Early (~10%–35%)**: Builds the JavaScript foundation React depends on: first-class functions, prototype-based inheritance, classes, `this` binding, the event loop, promises, and async/await. - **Early–Middle (~35%–48%)**: Introduces core React concepts — project setup with Create React App, JSX, components, props, styling, state, lifecycle methods, and event handling. - **Middle (~48%–60%)**: Covers Hooks (`useState`, `useEffect`) as the modern alternative to class-based state and lifecycle, plus the unmounting phase and cleanup. - **Late (~60%–85%)**: Applies concepts through a CRUD application with Material UI — identifying components, children props, conditional rendering, component communication, data grids, dialogs, and forms — then a Blog using React Router v6. - **Ending (~85%–100%)**: Closes with authentication and authorization: XSS/CSRF, same-origin policy, CORS, token storage, login, private routes, and logout in a Task List app built with React Bootstrap. 【Key Takeaways】 - **The component is React's core idea** (Opening): the book's whole argument is that React finally delivers cohesive, composable components rather than the spaghetti-fighting abstractions of the past. - **JavaScript fundamentals are prerequisites, not optional** (Early): first-class functions, prototype inheritance, and `this` binding are explained because React's patterns rest on them. - **Classes are syntactic sugar over prototypes** (Early): understanding constructor functions and `Object.setPrototypeOf` clarifies what `class` actually does under the hood. - **Async behavior follows the event loop** (Early): callbacks queue until the call stack empties, and async/await lets you write asynchronous code that reads synchronously. - **State drives re-rendering** (Middle): React components re-render in response to state changes, which is distinct from classical OO state. - **Hooks modernize state and lifecycle** (Middle): `useState` and `useEffect` replace much of what class components did, with cleanup handled at unmount. - **Component identification is a design skill** (Late): the book repeatedly shows how to split an app into components before implementing it. - **Auth is a full-stack concern** (Ending): XSS, CSRF, CORS, and token storage are treated alongside login, private routes, and logout. 【Reading Tips】 - Skim the JavaScript chapter if you're already fluent, but deep-read the `this` binding and event loop sections — they explain React bugs you'll hit later. - Treat the three applications as the real spine: read them in order (CRUD → Blog → Task List) since each adds a new layer (UI library, routing, auth). - Don't skip the "Identifying Components" sections — they're the book's most transferable skill. - When you reach Hooks, compare against the class-based versions shown earlier to see what's being replaced. - The auth chapter is security-flavored; read it carefully even if you only build frontends. 【Coverage Limits】 This guide is based on stratified excerpts covering the table of contents, JavaScript fundamentals, core React concepts, and the start of the practical applications; the excerpts do not cover the full implementation details of the Blog and Task List apps or the complete auth flow.
Page 4
. . 84 3.5 Components Communication . . . . . . . . . . . . . . . . . . . 90 3.6 Custom Environment Variables . . . . . . . . . . . . . . . . . 91 3.7 Data G...
View in text
Page 17
et [a, b, ...rest] = [1, 2, 3, 4, 5]; 12 //a = 1 13 //b = 2 14 //rest = [3, 4, 5] 1.4 Objects There are several ways to create objects in JavaScript. We will...
View in text
Excerpt 3
callback CHAPTER 1. ESSENTIAL JAVASCRIPT CONCEPTS 34 data. Another way to deal with promises is by using the async and await keywords. These keywords were ad...
View in text
Excerpt 4
12 return <h1>{this.state.startNumber}</h1>; 13 } 14 } state is managed and controlled by the component. On line 12, we have changed the use of props to use...
View in text
Excerpt 5
(e) => setState(e.target.value)} 16 /> 17 </div> 18 ); 19 } CHAPTER 2. ESSENTIAL REACT CONCEPTS 67 transforming the response into json on line 8, and then up...
View in text
Excerpt 6
Everything Rendered CHAPTER 3. A SIMPLE CRUD APPLICATION 92 8 const apiUrl = process.env.REACT_APP_API_URL; 9 10 function handleClick(item) { 11 setItemClick...
View in text
Excerpt 7
le. One property for each of the input elements of the form. So, have a look at the checkResponse function again. It first checks if in the response I have t...
View in text
Excerpt 8
position. We have already done this on the App.js component. See below an extraction from that component source code: 1 <Route path="/posts/author/:name" ele...
View in text
Tags
AI categories
Programming LanguageJavaScriptWeb Technology
Publisher: Leanpub
Publish Year: 2022
Language: English
Pages: 163
File Format: PDF
File Size: 2.4 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…