Tagged articles
7 articles
Page 1 of 1
Code Mala Tang
Code Mala Tang
Mar 19, 2025 · Frontend Development

When useState Becomes a Trap: Why useReducer Is the Better Choice

This article explains why overusing useState in complex React components can lead to tangled code and bugs, and demonstrates how switching to useReducer provides a single source of truth, clearer actions, and more maintainable state management.

ReactState Managementfrontend
0 likes · 12 min read
When useState Becomes a Trap: Why useReducer Is the Better Choice
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Oct 17, 2023 · Frontend Development

Comprehensive React Query Tutorial: Managing Server and Client State in React

This tutorial introduces React Query (TanStack Query), explains its motivation, demonstrates how to manage client and server state in React using hooks, Context, useReducer, and provides best practices for caching, optimistic updates, reducing duplicate requests, and performance optimization techniques.

Context APIState ManagementTanStack Query
0 likes · 17 min read
Comprehensive React Query Tutorial: Managing Server and Client State in React
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.

Reacthooksperformance
0 likes · 16 min read
Advanced Tips and Common Pitfalls for React Hooks (useState, useEffect, useContext, useReducer, etc.)
DaTaobao Tech
DaTaobao Tech
Aug 17, 2022 · Frontend Development

Understanding and Using the useReducer Hook in React

React’s useReducer hook, introduced in version 16.8, lets a component manage complex state by supplying a reducer function and an initial value, returning [state, dispatch] where dispatch triggers actions; it supports lazy initialization, centralizes updates, works with useContext for shared state, and is preferable to useState for non‑trivial logic but less suited than full Redux for large‑scale state needs.

JavaScriptReactState Management
0 likes · 19 min read
Understanding and Using the useReducer Hook in React
KooFE Frontend Team
KooFE Frontend Team
May 14, 2022 · Frontend Development

Mastering Global State in React: useReducer + Context Explained

This article explains how useReducer can replace useState for complex state logic, introduces Context for sharing data across components, demonstrates their combined usage with code examples, and compares this approach to React‑Redux, highlighting differences in data flow, rendering behavior, and suitable scenarios.

ReactcontextuseReducer
0 likes · 5 min read
Mastering Global State in React: useReducer + Context Explained
Youzan Coder
Youzan Coder
May 22, 2020 · Frontend Development

Why Does React Hooks Show Stale State? Unraveling Closures and Dependency Arrays

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
Why Does React Hooks Show Stale State? Unraveling Closures and Dependency Arrays