react-debugging

Diagnose infinite re-renders in Next.js React apps.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/vassovass/scl-v3 --skill react-debugging-vassovass
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-debugging
Source: https://github.com/vassovass/scl-v3/tree/main/.claude/skills/react-debugging
Command: npx skills add https://github.com/vassovass/scl-v3 --skill react-debugging-vassovass

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers identify and fix common React rendering problems that cause infinite re-renders and performance bottlenecks in Next.js apps such as StepLeague.

Core Features & Use Cases

  • Pattern recognition: Detects issues like Maximum update depth exceeded, useMemo/useCallback pitfalls, and useEffect dependency problems that cause re-renders.
  • Fix patterns: Provides actionable strategies including hydrate-once for URL params, memoization for derived arrays, stable callbacks, and ref-based persistence to prevent state resets on parent re-renders.
  • Use Case: When you observe your app rendering more times than expected in a page, apply these patterns to stabilize renders and improve performance.

Quick Start

Follow the steps to reproduce the issue in your Next.js component, run the React Profiler, and apply the fixes described in the pattern sections to resolve render loops.

Frequently Asked Questions about react-debugging

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix infinite render loops in React?

Infinite render loops occur when dependencies in useEffect or callbacks change on every render. Fix them by stabilizing dependencies—use useMemo for derived values, useCallback for functions, and ensure refs or stable objects aren't recreated. The React Profiler shows which component rerenders excessively.

What causes 'Maximum update depth exceeded' errors in Next.js?

'Maximum update depth exceeded' happens when state updates trigger rerenders that create new dependencies, causing useEffect to run again. Prevent this by memoizing callbacks with useCallback, stabilizing array dependencies with useMemo, and avoiding inline object or function creation in dependency arrays.

How do I stop useCallback and useMemo from causing performance issues?

useCallback and useMemo prevent rerenders only when dependencies stay stable. Common pitfalls include adding unstable dependencies, memoizing unnecessarily, or recreating memoized values. Wrap derived data and callbacks in these hooks only when they're passed to child components or used in dependency arrays.

How do I prevent state from resetting on parent rerenders in Next.js?

State resets when a parent rerenders because child components remount. Use refs to persist values across rerenders, or lift stable state higher. For URL parameters, apply hydrate-once patterns to prevent state changes during hydration that trigger unnecessary updates.

When should I use the React Profiler to debug render performance?

Use the React Profiler when you observe unexpected rerenders, slow page loads, or when components render more times than expected. It visualizes render duration and frequency, helping identify which components cause bottlenecks and whether dependency changes trigger cascading updates.