title: ReactJS: get data from form
body: <p>I have an array of questions that is being fetched and added to the state, it looks like that: </p>
  
  <pre><code>gigApplication: {
      title: 'Tell me about you',
      questions: [
        {
          title: 'do you know german?',
          type: 'radiobox',
          options: ['yes', 'no']
        },
        {
          title: 'what are you hobbies?',
          type: 'input',
          options: []
        },
        {
          title: 'do you know any of the following languages?',
          type: 'checkbox',
          options: ['spanish', 'italian', 'chinese', 'portuguese', 'esperanto']
        },
        {
          title: 'what countries what you been to??',
          type: 'checkbox',
          options: ['brazil', 'china', 'france']
        }
      ]
    }
  </code></pre>
  
  <p>and then I'm rendering it according to the questions type </p>
  
  <pre><code>render() {
      const { handleClose, openApply, gigApplication, classes, fullScreen } = this.props;
      const questions = gigApplication.questions.map((question, index) =&gt; {
        if (question.type === 'input') {
          return (
            &lt;DialogContent key={question.title} className={classes.dialogContent}&gt;
              &lt;DialogContentText&gt;{question.title}&lt;/DialogContentText&gt;
              &lt;TextField margin="dense" id="name" type="email" fullWidth /&gt;
            &lt;/DialogContent&gt;
          );
        }
        if (question.type === 'checkbox') {
          return (
            &lt;DialogContent key={question.title} className={classes.dialogContent}&gt;
              &lt;DialogContentText&gt;{question.title}&lt;/DialogContentText&gt;
              {question.options.map(option =&gt; (
                &lt;FormControlLabel
                  key={option}
                  control={
                    &lt;Checkbox
                      checked={this.state.jason}
                      // onChange={this.handleCheckBox(option)}
                      color="primary"
                      value={option}
                      name={question.title}
                      onClick={this.handleCheckBox(option, question, index)}
                    /&gt;
                  }
                  label={option}
                /&gt;
              ))}
            &lt;/DialogContent&gt;
          );
        }
        if (question.type === 'radiobox') {
          return (
            &lt;DialogContent key={question.title} className={classes.dialogContent}&gt;
              &lt;DialogContentText&gt;{question.title}&lt;/DialogContentText&gt;
              {question.options.map(option =&gt; (
                &lt;RadioGroup
                   key={option}
                   name={question.title}
                   className={classes.group}
                   value="yes"
                   value={option}
                   onChange={this.handleChange}
                 &gt;
                  &lt;FormControlLabel
                    name={question.title}
                    value={option}
                    control={&lt;Radio color="primary" /&gt;}
                    label={option}
                  /&gt;
                &lt;/RadioGroup&gt;
              ))}
            &lt;/DialogContent&gt;
          );
        }
      });
      return (
        &lt;FormControl onSubmit={this.handleSubmit}&gt;
          &lt;Dialog
            fullWidth
            className={classes.dialog}
            open={openApply}
            onClose={handleClose}
            fullScreen={fullScreen}
            aria-labelledby="form-dialog-title"
          &gt;
            &lt;DialogTitle id="form-dialog-title"&gt;{gigApplication.title}&lt;/DialogTitle&gt;
            {/* questions come from the const above */}
            {questions}
            &lt;DialogActions&gt;
              &lt;Button onClick={handleClose} color="primary"&gt;
                Cancel
              &lt;/Button&gt;
              {/* &lt;Button onClick={handleClose} color="primary"&gt;
                Send Application
              &lt;/Button&gt; */}
              &lt;Button type="submit" color="primary"&gt;
                Send
              &lt;/Button&gt;
            &lt;/DialogActions&gt;
          &lt;/Dialog&gt;
        &lt;/FormControl&gt;
      );
    }
  }
  </code></pre>
  
  <p>I'm using material-ui.</p>
  
  <p>What's the best way to get the data the user enters in those inputs when s/he submits the form?</p>
  
  <p>I can't figure out an easy way to acomplish that. Is there are function that gets all the data from the form when its submited ? </p>