Class components and migration
componentDidCatch
Reports a captured descendant error and component-stack information; pair with a pure fallback-state method.
Formal Syntax & Structure
react syntaxreact
componentDidCatch(error, info) { console.info("Synthetic error", info.componentStack); }Working Example
Example Snippetreact
componentDidCatch(error, info) { console.info("Synthetic error", info.componentStack); }