Chapter 16 · Example 3 · Universal error handling in React

State updates during render

Calling setState inside a catch block during render triggers an infinite re-render loop, showing why errors caught at render time cannot be handled with state.

Loading live editor…