Description
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
I wrote this component to recreate the warnings from #11081 and to fix it:
class App extends Component {
constructor() {
super();
this.state = {
value: null,
};
}
render() {
this.setState({
value: 'test',
});
return <div />;
}
}
And in the process found that this error came up:
'Uncaught Error: Maximum update depth exceeded. This can happen when a component repeatedly
calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of
nested updates to prevent infinite loops.'
But the execution did not stop. It was going in an infinite loop and printing 2 variants of the same error one after another.
Screenshot for your reference:
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template for React 16: https://jsfiddle.net/Luktwrdm/, template for React 15: https://jsfiddle.net/hmbg7e9w/).
Snippet given above
What is the expected behavior?
There shouldn't be an infinite loop. The execution should stop after printing the error.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React 16, Chrome 59, Ubuntu. I tested it in older versions of react and this problem is not present there.