Tag

useEffect

1 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.

HooksJavaScriptevent loop
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.

Hooksbest practicesfrontend
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.)
KooFE Frontend Team
KooFE Frontend Team
Nov 10, 2022 · Frontend Development

How to Prevent Race Conditions When Fetching Data in React

This article explains why asynchronous data fetching in React can cause race conditions that lead to flickering or mismatched content, and presents several practical solutions—including component remounting, data validation, cleanup effects, and request cancellation—to ensure reliable UI updates.

Promiseabortcontrollerdata-fetching
0 likes · 16 min read
How to Prevent Race Conditions When Fetching Data in React
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.

Hooksfrontendrace condition
0 likes · 9 min read
Avoiding Race Conditions in React Data Fetching with Hooks, Boolean Flags, and useRequest
KooFE Frontend Team
KooFE Frontend Team
Oct 16, 2022 · Frontend Development

How to Optimize Data Fetching in React for Better Performance

Learn how to optimize data fetching in React by understanding initial vs on‑demand requests, avoiding waterfall patterns, leveraging Promise.all, parallel promises, data providers, and browser limits, while applying best practices for useEffect, lifecycle handling, and performance‑focused component design.

Promise.alldata-fetchingfrontend
0 likes · 26 min read
How to Optimize Data Fetching in React for Better Performance
Tencent IMWeb Frontend Team
Tencent IMWeb Frontend Team
May 16, 2022 · Frontend Development

How to Prevent Race Conditions in React Data Fetching

This article explains what race conditions are in front‑end web development, demonstrates the issue with a React demo fetching articles, and walks through step‑by‑step solutions using custom hooks, useEffect cleanup, and AbortController to safely cancel outdated requests and avoid stale data rendering.

Custom Hookabortcontrollerdata-fetching
0 likes · 10 min read
How to Prevent Race Conditions in React Data Fetching
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
KooFE Frontend Team
KooFE Frontend Team
Aug 11, 2021 · Frontend Development

How to Make React Effects Work Correctly in Strict Mode

This article explains how React's Strict Effects mode double‑invokes effects and layout effects during mount and unmount, and provides practical patterns using refs, cleanup functions, and focus management to ensure components behave correctly when effects run multiple times.

RefStrictModefocus
0 likes · 10 min read
How to Make React Effects Work Correctly in Strict Mode
Tencent IMWeb Frontend Team
Tencent IMWeb Frontend Team
Jun 24, 2021 · Frontend Development

Mastering React Hooks: From Basics to Advanced Patterns

This article explains why React Hooks were introduced, walks through the fundamentals of useState and useEffect with clear code examples, and demonstrates how Hooks simplify state management, side‑effects, and component logic compared to traditional class components, enabling more maintainable frontend development.

HooksJavaScriptfrontend
0 likes · 19 min read
Mastering React Hooks: From Basics to Advanced Patterns
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.

Hooksbrowser renderingperformance
0 likes · 12 min read
Understanding the Execution Timing of useEffect and useLayoutEffect in React
QQ Music Frontend Team
QQ Music Frontend Team
Dec 15, 2019 · Frontend Development

Inside React’s useEffect: A Deep Dive into the Fiber Source Code

This article dissects the inner workings of React's useEffect hook by tracing its implementation through the React Fiber architecture, from mountEffect and updateEffect functions to the commit phase, revealing how side‑effects are scheduled, created, and cleaned up in modern React applications.

FiberHooksJavaScript
0 likes · 18 min read
Inside React’s useEffect: A Deep Dive into the Fiber Source Code
政采云技术
政采云技术
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 designHooksdebugging
0 likes · 21 min read
Reflections on the Design, Implementation, and Future of React Hooks