React: Maximum update depth exceeded
You are calling this.addQuestion
in your render method, which in turn calls setState
which will result in a new render, and the indefinite loop continues.
You want to give onClick
a function reference, not call it directly.
<button id="addQuestionButton" onClick={this.addQuestion}>Add Question</button>
this.addQuestion()
invoked every time the component re-renders, thus causing a loop.
Change the method this.addQuestion()
to () => this.addQuestion()
<button id="addQuestionButton" onClick={() => this.addQuestion()}>Add Question</button>