title: How I can push my state elements to the state array?
body: <p>I'm currently trying to push my state elements (<code>user_number_X</code>) into an array (<code>this.state.results.numbers</code>) but my input handler function is not working.</p>
  
  <p>How can I rewrite it so it will push input values into an array?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>export default class InputArea extends React.Component {
    constructor(props){
      super(props);
      this.state = {
        draw_number: '',
        user_number_1: '',
        user_number_2: '',
        user_number_3: '',
        user_number_4: '',
        user_number_5: '',
        user_number_6: '',
        results : {
          numbers: [],
          draws: ''
        }
      }
    }
  
    /* handledrawsChange = event =&gt; {
      this.setState({
        event
      })
    } */
  
    inputHandler = event =&gt; { 
      this.setState({[event.target.name]: event.target.value});
      this.state.results.numbers.push(event.target.value)
      // this.state.results.numbers.push(event.target.value)//this.setState({number: this.state.results.numbers.push(parseInt(event.target.value))});
    }
  
    componentDidMount() {
      fetch("http://localhost:8080/simulate", {
        method: "POST",
        body: this.state.results
      });
    }
  
  
    render() {
      console.log(this.state);
        return (
          &lt;InputField&gt;
            &lt;InputWrapper&gt;
              &lt;Label&gt;1st number&lt;/Label&gt;
              &lt;Input name="user_number_1" type="number" maxlength="2" value={this.state.user_number_1} onChange={this.inputHandler} required&gt;&lt;/Input&gt;
              &lt;Label&gt;2nd number&lt;/Label&gt;
              &lt;Input name="user_number_2" type="number" maxlength="2" value={this.state.user_number_2} onChange={this.inputHandler} required&gt;&lt;/Input&gt;
              &lt;Label&gt;3rd number&lt;/Label&gt;
              &lt;Input name="user_number_3" type="number" maxlength="2" value={this.state.user_number_3} onChange={this.inputHandler} required&gt;&lt;/Input&gt;
              &lt;Label&gt;4th number&lt;/Label&gt;
              &lt;Input name="user_number_4" type="number" maxlength="2" value={this.state.user_number_4} onChange={this.inputHandler} required&gt;&lt;/Input&gt;
              &lt;Label&gt;5th number&lt;/Label&gt;
              &lt;Input name="user_number_5" type="number" maxlength="2" value={this.state.user_number_5} onChange={this.inputHandler} required&gt;&lt;/Input&gt;
              &lt;Label&gt;6th number&lt;/Label&gt;
              &lt;Input name="user_number_6" type="number" maxlength="2" value={this.state.user_number_6} onChange={this.inputHandler} required&gt;&lt;/Input&gt;
              &lt;Label&gt;Number of draws:&lt;/Label&gt;
              &lt;Input name="draw_number" type="number" value={this.state.draw_number} onChange={this.inputHandler} required&gt;&lt;/Input&gt;
            &lt;/InputWrapper&gt;
            &lt;Button type="submit" /*onClick={this.drawsHandler}*/&gt;Let's win!&lt;/Button&gt;
          &lt;/InputField&gt;
        )
    }
  }
  </code></pre>