Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
openaec-foundation avatar

React Errors Debugging

  • 11 installs
  • 6 repo stars
  • Updated July 8, 2026
  • openaec-foundation/react-claude-skill-package

Helps with frontend development tasks.

About

react-errors-debugging is a Claude Code skill for frontend development. It helps solo builders move faster with AI-assisted development.

  • react-errors-debugging
  • Frontend Development
  • AI-coding skill

React Errors Debugging by the numbers

  • 11 all-time installs (skills.sh)
  • Ranked #1,658 of 2,245 Frontend Development skills by installs in the Skillselion catalog
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/openaec-foundation/react-claude-skill-package --skill react-errors-debugging

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs11
repo stars6
Last updatedJuly 8, 2026
Repositoryopenaec-foundation/react-claude-skill-package

What it does

Helps with frontend development tasks.

Files

SKILL.mdMarkdownGitHub ↗

react-errors-debugging

Quick Reference

Debugging Tools Overview

ToolPurposeWhen to Use
React DevTools (Components)Inspect props, state, hooks, contextComponent data inspection
React DevTools (Profiler)Render timing, flamegraph, ranked chartPerformance investigation
Browser DevTools (Console)Read React warnings and error messagesError diagnosis
Browser DevTools (Sources)Set breakpoints, step through codeLogic debugging
<StrictMode>Surface impure renders, unsafe effectsDevelopment-time bug prevention
why-did-you-renderLog unnecessary re-renders with reasonsRe-render optimization
Source mapsMap production errors to original sourceProduction debugging

Critical Warnings

NEVER remove <StrictMode> to "fix" double-rendering issues -- the double invocation is intentional. It exposes impure components and side effects. ALWAYS fix the underlying impurity instead.

NEVER ignore React console warnings -- they indicate real bugs or future breaking changes. ALWAYS resolve every warning before shipping.

NEVER debug production builds without source maps -- error messages are stripped and minified in production. ALWAYS generate source maps for staging/debugging environments.

ALWAYS check the component stack trace when diagnosing errors -- React prints the component tree path that led to the error, which pinpoints the source.

ALWAYS use the Profiler tab (not just the Components tab) when investigating performance -- visual inspection of the component tree does NOT reveal render timing.

---

Strict Mode

<StrictMode> is a development-only tool that helps find bugs by intentionally double-invoking certain functions.

What Strict Mode Double-Invokes

Function TypeDouble-Invoked?Why
Component function bodyYesDetects impure rendering (side effects during render)
useState initializerYesDetects impure initialization
useReducer reducerYesDetects impure reducers
useReducer initializerYesDetects impure initialization
useMemo callbackYesDetects impure memoization
useEffect setup + cleanupYes (mount/unmount/remount)Detects missing cleanup logic
useRef — NONoRefs are not double-invoked

Strict Mode Behavior

// StrictMode wraps your app (or a subtree)
import { StrictMode } from "react";

createRoot(document.getElementById("root")!).render(
  <StrictMode>
    <App />
  </StrictMode>
);

In development, React will: 1. Render component -> call cleanup -> re-render component (simulating unmount/remount) 2. Call state initializers twice and discard the first result 3. Call reducers twice and discard the first result

Common Strict Mode Mistakes

// BAD: Side effect in render — Strict Mode exposes this by double-calling
function Counter(): JSX.Element {
  const [count, setCount] = useState(0);
  document.title = `Count: ${count}`; // NEVER do this in render
  return <div>{count}</div>;
}

// GOOD: Side effect in useEffect
function Counter(): JSX.Element {
  const [count, setCount] = useState(0);
  useEffect(() => {
    document.title = `Count: ${count}`;
  }, [count]);
  return <div>{count}</div>;
}
// BAD: Effect without cleanup — Strict Mode exposes the leak
function ChatRoom({ roomId }: { roomId: string }): JSX.Element {
  useEffect(() => {
    const connection = createConnection(roomId);
    connection.connect();
    // Missing cleanup! StrictMode will connect TWICE
  }, [roomId]);
  return <div>Chat: {roomId}</div>;
}

// GOOD: Effect with proper cleanup
function ChatRoom({ roomId }: { roomId: string }): JSX.Element {
  useEffect(() => {
    const connection = createConnection(roomId);
    connection.connect();
    return () => connection.disconnect(); // ALWAYS clean up
  }, [roomId]);
  return <div>Chat: {roomId}</div>;
}

---

Console Warnings Diagnostic Table

Warning MessageCauseFix
"Each child in a list should have a unique 'key' prop"Array items rendered without key or with duplicate/index keysALWAYS provide a stable, unique key from data (e.g., id). NEVER use array index as key when items reorder.
"Cannot update a component (X) while rendering a different component (Y)"Calling setState of component X inside the render body of component YMove the state update into a useEffect or event handler. NEVER call setState during render of another component.
"Maximum update depth exceeded"Infinite re-render loop from setState in useEffect without proper depsCheck useEffect dependencies — ensure the effect does not unconditionally trigger its own dependency. Add missing deps or restructure logic.
"Objects are not valid as a React child"Passing an object/array directly as JSX child textConvert to string with JSON.stringify(), or map array to elements. NEVER render raw objects.
"Function components cannot be given refs"Passing ref to a function component without forwardRefWrap component with forwardRef (React 18) or accept ref as a prop (React 19).
"Can't perform a React state update on an unmounted component"setState called after component unmounted (React 17 and earlier)This warning was REMOVED in React 18. If seen in React 18+, you have a version mismatch. In React 17, use cleanup to cancel async operations.
"Invalid hook call"Hook called outside component/hook, or mismatched React versionsVerify hooks are at top level of component/hook. Check for duplicate React installations with npm ls react.
"Rendered more hooks than during the previous render"Conditional hook call — hook count changed between rendersNEVER call hooks inside conditions, loops, or early returns. ALWAYS call all hooks in the same order.

---

React DevTools

Components Tab

The Components tab shows the live component tree with inspectable data:

FeatureWhat It ShowsHow to Use
Component treeHierarchy of mounted componentsClick to select, use search to filter
Props panelCurrent props of selected componentExpand objects, edit values live
Hooks panelCurrent hook values (state, ref, memo, context)Shows hook name and current value
Source link"< >" icon links to component sourceClick to open in Sources tab
Rendered byWhich parent rendered this componentShows in sidebar when component selected
Owner stack (React 19)Full owner component chainShows which component created this one

Profiler Tab

FeaturePurposeInterpretation
FlamegraphVisualize render time per componentWide bars = slow renders. Grey bars = did not render.
Ranked chartComponents sorted by render durationFocus optimization on top-ranked components
"Why did this render?"Shows render trigger reasonEnable via gear icon -> "Record why each component rendered"
Commit selectorBrowse individual render commitsEach commit = one React render batch
Render durationTime in ms for each componentCompare before/after optimization

Profiler Workflow

1. Open React DevTools -> Profiler tab 2. Click gear icon -> enable "Record why each component rendered while profiling" 3. Click Record (blue circle) 4. Perform the interaction you want to measure 5. Click Stop 6. Analyze: flamegraph for overview, ranked chart for worst offenders 7. Check "Why did this render?" for each slow component

---

Component Stack Traces

When React throws an error, it prints a component stack trace showing the component hierarchy:

Error: Something went wrong
    at UserProfile (UserProfile.tsx:15)
    at div
    at Dashboard (Dashboard.tsx:8)
    at ErrorBoundary (ErrorBoundary.tsx:5)
    at App (App.tsx:12)

Reading Component Stacks

  • Read top to bottom: the topmost component is where the error occurred
  • Native HTML elements (e.g., at div) appear in the stack
  • File names and line numbers point to the component definition
  • ALWAYS look at the first custom component in the stack -- that is the error source

React 19 Improvements

React 19 introduces owner stacks via captureOwnerStack():

import { captureOwnerStack } from "react";

// In an error boundary or error handler:
function handleError(error: Error): void {
  const ownerStack = captureOwnerStack();
  console.error("Error:", error.message);
  console.error("Owner stack:", ownerStack);
  // Owner stack shows WHICH component created the erroring component
  // (not just the render tree, but the ownership/creation chain)
}

---

Common Error Messages Diagnostic Table

Error MessageCauseFix
Minified React error #XXXProduction build with stripped error messagesLook up the error code at https://react.dev/errors/XXX or debug with development build
Too many re-rendersComponent unconditionally calls setState during renderNEVER call setState directly in component body. Use useEffect or event handlers.
Hydration failed because the initial UI does not matchServer HTML differs from client renderEnsure server and client render identical output. Check for typeof window guards, Date.now(), or random values in render.
Cannot read properties of null (reading 'useState')Multiple React copies or hook called outside componentRun npm ls react to check for duplicates. Ensure hooks are called inside components only.
Uncaught Invariant ViolationInternal React assertion failedUsually indicates a bug in your code violating React rules. Check the message details.
Element type is invalid: expected a string or class/functionComponent is undefined at render timeCheck import statement — likely a typo, default vs named export mismatch, or circular dependency.
Cannot update during an existing state transitionsetState called inside render() or getDerivedStateFromPropsMove state update to useEffect or componentDidMount/componentDidUpdate.

---

Development vs Production Differences

AspectDevelopmentProduction
Error messagesFull descriptive messages with component stacksMinified error codes (e.g., Minified React error #310)
Strict ModeActive (double-invokes renders, effects)Completely stripped — no double invocations
Console warningsAll warnings displayedMost warnings suppressed
PerformanceSlower due to extra checks, Strict Mode overheadOptimized, no dev-only checks
ProfilingDevTools Profiler works out of the boxRequires profiling build: react-dom/profiling
Source mapsAvailable by default (dev server)Must be explicitly generated and deployed
PropTypesValidated at runtime (if used)Stripped entirely

Debugging Production Errors

1. Look up minified error codes: Visit https://react.dev/errors/{code} for the full message 2. Generate source maps: Configure your bundler to produce .map files for staging 3. Use profiling build for production performance analysis:

// webpack.config.ts — alias for profiling build
resolve: {
  alias: {
    "react-dom$": "react-dom/profiling",
    "scheduler/tracing": "scheduler/tracing-profiling",
  },
}

4. Error monitoring: Use services that can decode source maps server-side (Sentry, Bugsnag)

---

React 19 Debugging Improvements

FeatureReact 18React 19
Hydration mismatch errorsGeneric "did not match" messageDetailed diff showing exact HTML differences
Error reportingComponent stack onlyOwner stacks via captureOwnerStack()
Third-party script handlingHydration errors on injected elementsAutomatically skips unexpected <script>, <style>, <link> in <head>/<body>
ref on function componentsRequires forwardRef wrapperref is a regular prop — no wrapper needed
useEffect cleanup timingSynchronous during unmountConsistent async cleanup with transition support

---

Debugging Tools Setup

React DevTools Extension

ALWAYS install the React DevTools browser extension for Chrome or Firefox. It adds the Components and Profiler tabs to browser DevTools.

  • Chrome: Search "React Developer Tools" in Chrome Web Store
  • Firefox: Search "React Developer Tools" in Firefox Add-ons
  • Standalone (for React Native/iframe): npx react-devtools

why-did-you-render Library

For granular re-render tracking beyond DevTools Profiler:

// wdyr.ts — MUST be imported BEFORE React
import React from "react";

if (process.env.NODE_ENV === "development") {
  const whyDidYouRender = await import("@welldone-software/why-did-you-render");
  whyDidYouRender.default(React, {
    trackAllPureComponents: true,
  });
}

// Then on specific components:
MyComponent.whyDidYouRender = true;

---

Reference Links

  • references/examples.md -- Debugging workflow examples with step-by-step instructions
  • references/anti-patterns.md -- Common debugging mistakes and how to avoid them

Official Sources

  • https://react.dev/learn/react-developer-tools
  • https://react.dev/reference/react/StrictMode
  • https://react.dev/reference/react/Profiler
  • https://react.dev/errors
  • https://react.dev/blog/2024/04/25/react-19

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.