text: import React, {Component} from 'react';
  
  class Form extends Component {
      constructor(props) {
          super(props);
          
          this.initialState = {
              name: '',
              job: '',
              title:''
          };
  
          this.state = this.initialState;
      }
  
      handleChange = event => {
          const { name, value } = event.target;
  
          this.setState({
              [name] : value
          });
      }
  
      onFormSubmit = (event) => {
          event.preventDefault();
          
          this.props.handleSubmit(this.state);
          this.setState(this.initialState);
      }
  
      render() {
          const { name, job, title } = this.state; 
  
          return (
              <form onSubmit={this.onFormSubmit}>
                  <label for="name">Name</label>
                  <input 
                      type="text" 
                      name="name" 
                      id="name"
                      value={name} 
                      onChange={this.handleChange} />
                  <label for="job">Job</label>
                  <input 
                      type="text" 
                      name="job" 
                      id="job"
                      value={job} 
                      onChange={this.handleChange} />
                      <label for="title">Title</label>
                  <input 
                      type="text" 
                      name="title" 
                      id="title"
                      value={title} 
                      onChange={this.handleChange} />
                      
                      
                  <button type="submit">
                      Submit..
                  </button>
              </form>
          );
      }
  }
  
  export default Form;
  