setState inside a loop - React
I am trying to build a questionnaire in react. For now, all my answers will be accepted using the textbox. These will then be sent to my api using the ajax call. I want my params to have following structure, questionnaire: { {question: "question", answer: "answer"}, {question: "question2", answer: "answer2"}, {question: "question3", answer: "answer3"} } My code so far is really messy but somehow i'm getting the desired results. However, i'm unable to update the state of my answer and keep getting the Uncaught TypeError: Cannot read property 'setState' of undefined import React, { PropTypes }