Calling `ReactDOMServer.renderToStaticMarkup(elementWithPortal);` gets stuck in a loop while trying to do a static render.

Current behavior:
The behavior can be seen here: https://codepen.io/anon/pen/BmqWOM  by un-commenting line 58 (warning: this will make your tab freeze)

Expected behavior:
It should return with results or throw some kind of error if the input is not valid

componentDidMount() {
          mountCount++;
        }
        click = () => {
          numClicks++;
        };
        render() {
          return (
            <span ref="span" onClick={this.click}>
              Name: {this.props.name}
            </span>
          );
        }
      }
      var element = document.createElement('div');
      ReactDOM.render(<TestComponent />, element);
      var lastMarkup = element.innerHTML;
      
      
      ReactDOM.render(<TestComponent name="x" />, element);
      expect(mountCount).toEqual(1);
      
      
      ReactDOM.unmountComponentAtNode(element);