title: Correct way to take input values in React.js
body: <p>I am new to react and i am wondering if this is the correct way (somewhat quallity code) to get values from input forms.
  import React from 'react';</p>
  
  <pre><code>class Form extends React.Component {
      constructor() {
          super();
          this.state = {
              nameValue: '',
              ageValue: ''
          }
      }
      onChangeName(event) {
          this.setState({
              nameValue:event.target.value
          });
  
      }
      onChangeAge(event) {
          this.setState({
              ageValue: event.target.value
          });
      }
      showValue(){
          alert('name '+ this.state.nameValue + ' age: ' + this.state.ageValue)
      }
      render() {
          return (
              &lt;form&gt;
                  &lt;label&gt;Name:
                      &lt;input type="text" onChange={this.onChangeName.bind(this)}/&gt;
                  &lt;/label&gt;
                  &lt;label&gt;Age:
                      &lt;input type="text" onChange={this.onChangeAge.bind(this)}/&gt;
                  &lt;/label&gt;
                  &lt;input type="submit" value="Submit" onClick={this.showValue.bind(this)}/&gt;
              &lt;/form&gt;
  
          );
      }
  }
  export default Form;
  </code></pre>
  
  <p>I mean i heared that the way it's done in react is so that every component should be somewhat independant and have it's own behaviour. Btw the code works just asking for the qualiity cause i have project in from of me. <strong>Or</strong> should i just add an event to the button and make the other componenents stateless, i.e the 2 input fields</p>