React & Modern Frontend (445 Qs)•Part 8: Advanced React Patterns, Portals & Performance (152 - 261)
What is the benefit of component stack trace from error boundary?
Apart from error messages and javascript stack, React16 will display the component stack trace with file names and line numbers using error boundary concept.
For example, BuggyCounter component displays the component stack trace as below,

Practical Code Example
text
// Component Stack Trace from Error Boundary identifies the exact JSX component tree hierarchy
// pointing directly to the offending file and line number:
// in BrokenComponent (at App.js:14)
// in ErrorBoundary (at App.js:12)
// in div (at App.js:10)