У нас вы можете посмотреть бесплатно React_Hooks v1.5.pdf: Chapter Nine. или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
In the book Designing React Hooks the Right Way (Packt Publishing), Chapter 8: "Use Ref to Hide Stuff" focuses on utilizing the useRef hook to manage side effects, DOM access, and persistent values without triggering re-renders. Key Topics Covered in Chapter 9: Accessing DOM Elements: How to interact with raw DOM nodes directly using useRef. Understanding useRef Design: A deep dive into the purpose and source code of the useRef hook. Persistent Values Without Rerenders: Working with data that needs to persist across renders but does not require a UI update. Practical Examples: Applying refs to common scenarios such as: Clicking outside of a menu. Avoiding memory leaks. Locating current values. Appendix Topics: Callback refs and forwardRef. This chapter follows the previous chapter on useContext and prepares the reader for the subsequent chapter on creating custom hooks. Depending on which prominent React resource you are following, "Chapter Eight" focuses on either managing global state through the Context API or mastering the useRef hook. 1. React Hooks in Action (John Larsen) In this widely-cited book, Chapter 8 is titled "Managing state with the Context API". It focuses on: The Context API: Moving beyond "prop drilling" by delivering state directly to deeply nested components. useContext Hook: How to consume context state efficiently within functional components. Custom Providers: Building custom provider components to wrap specific areas of your application. Optimization: Techniques to avoid unnecessary re-renders when updating values in context. 2. Designing React Hooks the Right Way (Daniel Bugl) In this guide, Chapter 8 is titled "Use Ref to Hide Stuff". It covers: useRef Hook: Understanding the design and source code behind refs to hold persistent values that don't trigger re-renders. DOM Access: Using refs to directly interact with DOM elements (e.g., for focus management or scroll positions). Practical Problems: Solving common UI issues like detecting clicks outside a menu or preventing memory leaks. Advanced Topics: Brief introductions to callback refs and forwardRef. 3. React Query: Server State Management If you are learning about specialized hooks for data fetching, Chapter 8 in many React Query resources (like those from Packt) focuses on "Testing React Query Hooks and Components". Testing Libraries: Using the React Hooks Testing Library and Mock Service Worker (MSW). Mocking: How to simulate useQuery and useMutation behavior in unit tests. Are you following a specific book or course? Knowing the title will help me provide the exact syllabus for that version. "Chapter 9: Use Ref to Hide Stuff" from Designing React Hooks the Right Way (Packt Publishing) focuses on mastering the useRef hook to manage mutable data and direct DOM access without triggering re-renders. Here is a long description of the topics covered in this chapter: Core Concepts and useRef Design Introduction to useRef: Unlike useState, useRef is a hook that allows developers to persist values across renders without causing the component to re-render when the value changes. The .current Property: The hook returns a mutable object whose .current property holds the value. Accessing DOM Elements: The primary use case for useRef is interacting directly with DOM nodes, such as focusing an input, measuring element dimensions, or integrating with non-React third-party libraries. Key Topics and Practical Applications State Without an Update: Demonstrates how to use useRef for tracking mutable values that do not need to trigger a UI update, such as timers or previous props. Clicking Outside the Menu: A common UI pattern (dropdowns/modals) is implemented by using a ref to detect clicks outside a specific DOM element. Avoiding Memory Leaks: Using useRef to store subscription IDs or timer IDs, ensuring they can be cleaned up in a useEffect cleanup function. Locating Current Values: Techniques for managing persistent mutable data throughout the component lifecycle. Performance Optimization: Using refs to cache values, preventing unnecessary computations on re-renders. Advanced Ref Techniques (Appendix/Bonus Topics) Callback Refs: Using a function to set a ref, which allows for more control over when a ref is attached or detached. Forwarding Refs (forwardRef): Techniques to allow a component to pass a ref to one of its children, critical for creating reusable component libraries. This chapter emphasizes the "right way" to handle side effects and DOM interactions, ensuring that functional components remain efficient and maintainable. In the context of the popular technical book "Designing React Hooks the Right Way" by Daishi Kato, Chapter Eight is titled "Use Ref to Hide Stuff." This chapter marks a transition from state management to handling persistent data and direct DOM manipulation. Key Focus Areas of Chapter Eight Direct DOM Access: Learn to use the use Ref hook to interact directly with DOM elements, such as focusing.