Tag

useEffect

0 views collected around this technical thread.

Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Jan 8, 2025 · Frontend Development

Understanding useEffect Execution Mechanism and Cleanup in React

This article explains the purpose of React's useEffect hook, details how dependency arrays control its execution timing, demonstrates cleanup functions, and provides practical code examples for handling side effects such as data fetching, timers, and event listeners.

HooksJavaScriptcleanup
0 likes · 7 min read
Understanding useEffect Execution Mechanism and Cleanup in React
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
May 25, 2024 · Frontend Development

Understanding the Execution Timing of useEffect in React

This article explains when React's useEffect callbacks run—whether synchronously before rendering or asynchronously after rendering—by analyzing four demos, discussing the impact of event types, rendering workload, and React's internal scheduling rules.

Event LoopHooksJavaScript
0 likes · 12 min read
Understanding the Execution Timing of useEffect in React
HelloTech
HelloTech
Jan 11, 2024 · Frontend Development

React Fiber Workflow and Hook Implementation Overview

React’s core fiber system traverses a depth‑first tree using performUnitOfWork, splits rendering into beginWork and completeWork, then commits in before‑mutation, mutation, and layout phases, while hooks like useState and useEffect are implemented via linked‑list queues that ensure deterministic updates and side‑effect handling.

FiberHooksJavaScript
0 likes · 8 min read
React Fiber Workflow and Hook Implementation Overview
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Sep 21, 2023 · Frontend Development

Avoiding Unnecessary useEffect Usage in React: Best Practices and Patterns

This article explains the pitfalls of overusing the useEffect hook in React, demonstrates how to replace redundant effects with direct state calculations, memoization, and event‑handler logic, and provides practical code examples for improving performance and simplifying component design.

Best PracticesHooksPerformance
0 likes · 15 min read
Avoiding Unnecessary useEffect Usage in React: Best Practices and Patterns
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Aug 11, 2023 · Frontend Development

Deep Dive into React useEffect and useLayoutEffect: Data Structures, Lifecycle, and Implementation Details

This article explains how React manages side‑effects with useEffect and useLayoutEffect, covering the underlying Effect data structure, the mount and update phases, the commit pipeline (before‑mutation, mutation, layout), and the differences in timing and execution between the two hooks.

HooksJavaScriptfrontend
0 likes · 28 min read
Deep Dive into React useEffect and useLayoutEffect: Data Structures, Lifecycle, and Implementation Details
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Feb 13, 2023 · Frontend Development

Advanced Tips and Common Pitfalls for React Hooks (useState, useEffect, useContext, useReducer, etc.)

This article provides in‑depth guidance on using React hooks such as useState, useEffect, useContext, useReducer, and related utilities, covering lazy initialization, functional updates, performance‑optimising patterns, state sharing strategies, and advanced techniques like useImmer and react‑tracked to reduce mental overhead and avoid bugs.

HooksPerformancereact
0 likes · 16 min read
Advanced Tips and Common Pitfalls for React Hooks (useState, useEffect, useContext, useReducer, etc.)
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Nov 9, 2022 · Frontend Development

Avoiding Race Conditions in React Data Fetching with Hooks, Boolean Flags, and useRequest

This article explains what race conditions are, demonstrates how they can occur in React components during asynchronous data fetching, and provides practical solutions using component lifecycle checks, boolean cancellation flags, the ahooks useRequest hook, and React Suspense to ensure correct UI updates.

HooksRace Conditionfrontend
0 likes · 9 min read
Avoiding Race Conditions in React Data Fetching with Hooks, Boolean Flags, and useRequest
Beike Product & Technology
Beike Product & Technology
Jan 7, 2022 · Frontend Development

Understanding React Hooks: Principles, Implementation, and Usage

This article explains why React introduced Hooks, how they solve state‑reuse and component‑complexity problems, details the internal fiber architecture behind useState, useReducer, useEffect, useLayoutEffect, useCallback and useMemo, and provides practical code examples for each.

HooksJavaScriptfrontend
0 likes · 18 min read
Understanding React Hooks: Principles, Implementation, and Usage
Fulu Network R&D Team
Fulu Network R&D Team
Aug 10, 2020 · Frontend Development

Understanding the Execution Timing of useEffect and useLayoutEffect in React

This article explains the differences in execution timing between React's useEffect and useLayoutEffect hooks, analyzes their underlying mechanisms, demonstrates practical demos with performance monitoring, and delves into React's rendering process, scheduler, and related browser rendering concepts.

HooksPerformancebrowser rendering
0 likes · 12 min read
Understanding the Execution Timing of useEffect and useLayoutEffect in React
政采云技术
政采云技术
Sep 8, 2019 · Frontend Development

Understanding and Using React Hooks: Concepts, Built‑in Hooks, and Custom Hook Development

This article introduces the concept of React Hooks, explains the built‑in hooks such as useState, useEffect, useCallback, useMemo, useRef, and useContext, demonstrates their usage with complete code examples, and guides readers on creating their own custom hooks for reusable logic in functional components.

Custom HookHooksJavaScript
0 likes · 15 min read
Understanding and Using React Hooks: Concepts, Built‑in Hooks, and Custom Hook Development
Ctrip Technology
Ctrip Technology
Jul 18, 2019 · Frontend Development

React Hooks: From Mixins and HOCs to Custom Hook Implementations and Production Practices

This article explains the evolution of React component reuse—from legacy mixins and higher‑order components to modern React Hooks—provides step‑by‑step implementations of custom hooks such as useLogTime, useFetchHook, useInterval and useImgLazy, and demonstrates how to apply them in real‑world production code for better performance and maintainability.

CustomHookHOCHooks
0 likes · 22 min read
React Hooks: From Mixins and HOCs to Custom Hook Implementations and Production Practices
UC Tech Team
UC Tech Team
Dec 26, 2018 · Frontend Development

Reflections on the Design, Implementation, and Future of React Hooks

The article provides a comprehensive analysis of React Hooks, covering their injection model, persistent call ordering, debugging and testing strategies, API design considerations such as useReducer, Context Provider, useEffect, missing APIs, type handling, compilation optimizations, safety concerns, and the overall motivation behind moving from class components to hooks.

API designHooksTesting
0 likes · 21 min read
Reflections on the Design, Implementation, and Future of React Hooks