Book Image

React Hooks Tips Only the Pros Know [Video]

By : ABL THE PROBLEM SOLVER
Book Image

React Hooks Tips Only the Pros Know [Video]

By: ABL THE PROBLEM SOLVER

Overview of this book

Are you loving React but new to the Hooks API? Are you already using React Hooks but not sure you are doing the right thing? Or maybe you are sometimes getting tripped up by some of the React Hooks details? The addition of the Hooks API to React was quite a major change. Before React Hooks, most components had to be class-based. Now, with Hooks, these are often much simpler functional components. Hooks can be really simple to use. There are still plenty of ways you can mess up with React Hooks. And it often turns out there are many ways where you can improve your components by a better understanding of how each React Hook can be used. In this course, you are not just going to look at how to use React Hooks but also go behind the scenes and dive into the source code of React and the React ESLint rules to see why Hooks work the way they do. Here, you will learn all about using React Hooks and the pros and cons of the various Hooks. You will learn when to use useState() versus useReducer(). You will look at using useContext() efficiently. You will see when to use useLayoutEffect() and when useEffect() is better. You will be creating several reusable custom Hooks. Finally, you will combine all you learned into a more complete utility library to show how it all comes together. By the end of this course, you will have learned all about React Hooks with TypeScript. All the resource files are uploaded on the GitHub repository at https://github.com/PacktPublishing/react-hooks-tips-only-the-pros-know-course
Table of Contents (4 chapters)
Chapter 3
React Hooks – Beyond the Basics
Content Locked
Section 3
The Standard useRef() Hook
This video explains the useRef() Hook that returns a mutable ref object whose current property is initialized to the passed argument.