During the commit phase (when updates are flushed to the DOM), errors that are thrown inside `componentDidMount` and `componentDidUpdate` are trapped so they can be handled later, after the tree has been committed.

An error thrown in a `setState` callback should be trapped and handled the same way.

Here's the relevant section of code: https://github.com/facebook/react/blob/master/src/renderers/shared/fiber/ReactFiberCommitWork.js#L302-L330

`callCallbacks` calls all the `setState` callbacks that are part of the update queue (a linked list of updates). If any of those callbacks throw an error, we should catch the error and continue calling the rest of the callbacks.

This is a good first issue for someone interested in contributing to React/React Fiber. Please read [Fiber Principles: Contributing to Fiber](https://github.com/facebook/react/issues/7942) before submitting a PR.
ops.push('Bar');
      return <div>{props.children}</div>;
    }
    function Middle(props) {
      ops.push('Middle');
      return <span>{props.children}</span>;
    }
    var middleContent = (
      <div>
        <Middle>Hello</Middle>
        <Bar>-</Bar>
        <Middle>World</Middle>
      </div>
    );
    var step0 = (
      <div>
        <Middle>Hi</Middle>
        <Bar>{'Foo'}</Bar>
        <Middle>There</Middle>
      </div>
    );
    function Foo(props) {