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

React Error Handling

  • 90 installs
  • 14 repo stars
  • Updated March 2, 2026
  • oakoss/agent-skills

Helps with frontend development tasks during AI-assisted development.

About

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

  • react-error-handling
  • Frontend Development
  • AI-coding skill

React Error Handling by the numbers

  • 90 all-time installs (skills.sh)
  • +2 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #1,087 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/oakoss/agent-skills --skill react-error-handling

Add your badge

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

Listed on Skillselion
Installs90
repo stars14
Last updatedMarch 2, 2026
Repositoryoakoss/agent-skills

What it does

Helps with frontend development tasks during AI-assisted development.

Files

SKILL.mdMarkdownGitHub ↗

React Error Handling

Overview

Error boundaries catch JavaScript errors during rendering, in lifecycle methods, and in constructors of child components. They display fallback UIs instead of crashing the entire component tree. Error boundaries can only be implemented as class components in vanilla React, but the react-error-boundary library provides a convenient function component wrapper.

When to use: Component crashes, preventing error propagation to parent routes, graceful degradation, user-facing error states, error logging and monitoring.

When NOT to use: Event handler errors (use try/catch), async callbacks outside rendering (setTimeout, promises without Suspense), server-side rendering errors, errors in the boundary itself.

Quick Reference

PatternAPIKey Points
Class boundarygetDerivedStateFromError + componentDidCatchManual implementation, full control
Function boundary<ErrorBoundary FallbackComponent={...} />Uses react-error-boundary library
Reset mechanismresetErrorBoundary() or resetKeys={[dep]}Auto-reset on state change or manual retry
Error loggingonError={(error, info) => log(error)}Log to analytics or monitoring service
Fallback componentFallbackComponent={MyFallback}Receives error and resetErrorBoundary
Inline fallbackfallback={<div>Error occurred</div>}Static JSX, no error details
Render prop fallbackfallbackRender={({ error, reset }) => <UI />}Dynamic fallback with error access
Nested boundariesWrap at multiple tree levelsGranular error isolation
Route-level boundaryTanStack Router errorComponentDelegate to tanstack-router skill
Suspense integrationWrap Suspense boundaries for async errorsCatch errors thrown by Suspense
Event handler errorstry/catch in handler, not error boundaryBoundaries don't catch event errors
useErrorBoundary hookconst { showBoundary, resetBoundary } = useErrorBoundaryManually trigger boundary from child

Common Mistakes

MistakeCorrect Pattern
Using error boundary for eventsUse try/catch in event handlers
Wrapping every single componentPlace boundaries at meaningful UI sections
Not providing reset mechanismInclude retry button or resetKeys
Showing stack traces in prodOnly render stack in development mode
Missing onError for loggingAlways log errors to monitoring service
Catching errors in boundary selfError boundaries only catch child component errors
Using async code in getDerivedgetDerivedStateFromError must be pure, use didCatch
Relying on componentDidCatchUse getDerivedStateFromError for state updates
Not testing error boundariesTest with error-throwing components
Ignoring resetKeys patternUse resetKeys for automatic recovery on state change
Blocking Suspense fallbacksError boundaries around Suspense should allow fallbacks

Delegation

If the tanstack-router skill is available, delegate route-level error handling (errorComponent, notFoundComponent, loader errors) to it. Otherwise, recommend: npx skills add oakoss/agent-skills --skill tanstack-router
  • Error monitoring setup: Delegate to integration/observability specialists
  • Complex recovery flows: Use Task agent for multi-step error recovery patterns
  • Error boundary testing: Delegate test writing to testing specialists

References

  • Class-based error boundaries
  • react-error-boundary library
  • Fallback UI patterns
  • Reset and recovery patterns
  • Error boundary placement strategies

Related skills

This week in AI coding

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

unsubscribe anytime.