title: generic event handler to set the state of any form field
body: <p>Here we have to write three functions to change the state of all input fields of form and in case if we have more fields e.g phone and address we have to write two more functions to change the state of those fields, i want to ask is there any way we can write only a single generic function to change the state of any field of this form rather than write separate function for every form field?     </p>
  
  <pre><code>class SignUpForm extends React.Component {
          constructor() {
              super();
              this.state = {
                  name: '',
                  email: '',
                  password: '',
  
              };
          }
  
          handleNameChange = (evt) =&gt; {
              this.setState({name: evt.target.value});
          }
  
          handleEmailChange = (evt) =&gt; {
              this.setState({email: evt.target.value});
          }
  
          handlePasswordChange = (evt) =&gt; {
              this.setState({password: evt.target.value});
          }
          render(){
              return(
                  &lt;form onSubmit={this.handleSubmit}&gt;
                      &lt;input
                          type="text"
                          placeholder="Enter Name"
                          value={this.state.name}
                          onChange={this.handleNameChange}
                      /&gt;
                      &lt;input
                          type="text"
                          placeholder="Enter email"
                          value={this.state.email}
                          onChange={this.handleEmailChange}
                      /&gt;
                      &lt;input
                          type="password"
                          placeholder="Enter password"
                          value={this.state.password}
                          onChange={this.handlePasswordChange}
                      /&gt;
                      &lt;button disabled={isDisabled}&gt;Sign up&lt;/button&gt;
                  &lt;/form&gt;
              )
          }
  
      }
  </code></pre>