DEV Community

Discussion on: How to handle errors effectively in React JS?

Collapse
 
fjones profile image
FJones • Edited

Please don't use unnecessary plugins just to avoid writing class components. Writing a single ErrorBoundary class component and wrapping that in a functional HOC is easy and lightweight enough, and allows you much more flexibility in rendering and hooking into the error-capturing code. It also lets you reuse the error boundary visual components outside of explicit React error propagation.

Collapse
 
jyotishman profile image
Jyotishman Saikia

Thanks FJones for the feedback!
Would be great if you can provide a codepen for it.