Tagged articles
useEffect
29 articles · Page 1 of 1
The article examines why many React projects become unstable due to misuse of hooks, presenting seven frequent anti‑patterns with concrete bad and good code examples, explaining the underlying problems, and offering practical guidelines and a checklist to write reliable Hook‑based effects.
Anti-PatternReactfrontend
0 likes · 14 min read

This guide explains what useEffect does, its three core execution rules, how dependency arrays change its behavior, eight practical scenarios, six typical pitfalls with concrete code examples, and best‑practice recommendations for writing clean, leak‑free React functional components.
JavaScriptMemory LeakReact
0 likes · 10 min read

This article dissects a common React interview snippet that uses useEffect for data fetching, exposing hidden pitfalls such as component unmount updates, request race conditions, and missing error handling, and then presents a robust solution with cleanup logic and proper error management.
Frontend InterviewReactState Management
0 likes · 8 min read

This guide explains why memory leaks occur in React, how to spot early warning signs, and provides step‑by‑step techniques—including Chrome DevTools, React DevTools, and proper cleanup of timers, event listeners, fetch requests, and refs—to prevent and resolve leaks for more stable applications.
Memory LeakReactcleanup
0 likes · 13 min read

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.
JavaScriptReactcleanup
0 likes · 7 min read

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.
Reactevent-loopfrontend
0 likes · 12 min read

This article explains why useEffect in React is an "escape hatch" between functional and imperative code, outlines common pitfalls, provides twelve concrete scenarios where useEffect should be avoided or replaced, and offers best‑practice alternatives such as inline calculations, useMemo, event handlers, state lifting, and custom hooks.
ReactuseEffect
0 likes · 28 min read

This article explains React Hooks introduced in version 16.8, detailing the purpose and usage of common hooks such as useState, useEffect, useContext, useReducer, useRef, useCallback, and useMemo, and provides practical code examples for each.
Reactfrontendhooks
0 likes · 9 min read

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.
FiberJavaScriptReact
0 likes · 8 min read

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 Practicesfrontendperformance
0 likes · 15 min read

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.
JavaScripthooksuseEffect
0 likes · 28 min read

This article explains why React's synchronous component model struggles with async data fetching, demonstrates how to cancel stale requests, introduces a refetch‑only hook, and shows how to implement caching and deduplication to make queries pure functions, while recommending React Query and SWR for production use.
CachingCustom HookReact
0 likes · 9 min read

This article explains the core implementation of React Hooks introduced in React 16.8, covering the internal Hook manager, the built‑in Hook functions such as useState, useEffect, useReducer, and provides simplified code examples to illustrate how state and side‑effects are managed within function components.
JavaScripthooksuseEffect
0 likes · 9 min read

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.
Reacthooksperformance
0 likes · 16 min read

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.
AbortControllerData Fetchingrace condition
0 likes · 16 min read

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.
race conditionuseEffectuseRequest
0 likes · 9 min read

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.
Data FetchingPromise.allReact
0 likes · 26 min read

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.
AbortControllerCustom HookData Fetching
0 likes · 10 min read

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.
JavaScriptReacthooks
0 likes · 18 min read

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.
FocusReactRef
0 likes · 10 min read

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.
JavaScriptReactuseEffect
0 likes · 19 min read

This article explains how React’s functional nature, rooted in pure functions and side‑effect management, leads to the design of Hooks such as useState and useEffect, and walks through their implementation details and practical considerations.
Reactfrontendfunctional programming
0 likes · 13 min read

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.
Reactbrowser renderinguseEffect
0 likes · 12 min read

This article explores why React Hooks can display stale state values, comparing functional and class components, explaining closure behavior, dependency‑array mechanics, proper data‑fetching patterns, and when to replace useState with useReducer to avoid common pitfalls.
ReactState Managementfunctional components
0 likes · 13 min read

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.
FiberJavaScriptReact
0 likes · 18 min read


政采云技术Sep 8, 2019 · Frontend 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 HookJavaScriptReact
0 likes · 15 min read

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.
CustomHookHOCReact
0 likes · 22 min read

This article explains React Hooks introduced in version 16.8, their backward‑compatible design, how they replace class components, and provides detailed guidance on using useState, useEffect, custom hooks, useReducer, useRef, useMemo, useCallback, and related linting rules with performance‑focused examples.
JavaScriptReacthooks
0 likes · 16 min read

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 DesignDebuggingReact
0 likes · 21 min read
