In this video we are going to learn about forms.
Lets see how to add a form.
Switch to the project and inside the post component.
Add the form tag and inside the form add the some input fields as following.

<form>
<input type=\"text\" name=\"name\" />
<input type=\"email\" name=\"email\" />
<input type=\"text\" name=\"phone\" />
<button>Submit</button>
</form>


Now create handleChange function.
handleChange=(e)=>{
this.setState({
[e.target.name]:e.target.value.
});
}

Now add the onChange event to the input fields and call this handleChange function as following.


<form>
<input type=\"text\" name=\"name\" onChange={this.handleChange} />
<input type=\"email\" name=\"email\" onChange={this.handleChange} />
<input type=\"text\" name=\"phone\" onChange={this.handleChange} />
<button>Submit</button>
</form>


Now create hanleSubmit function.


handleSubmit=(e)=>{
e.preventDefault();
console.log('Name',this.state.name);
console.log('Email',this.state.email);
console.log('Phone',this.state.phone);
}



Now call this function to the onSubmit event in form add the onSubmit event as following.


<form onSubmit={this.handleSubmit} >
<input type=\"text\" name=\"name\" onChange={this.handleChange} />
<input type=\"email\" name=\"email\" onChange={this.handleChange} />
<input type=\"text\" name=\"phone\" onChange={this.handleChange} />
<button>Submit</button>
</form>


Now lets check so go to the browser and make console visible.
So press Ctrl + Shift + i now click on console tab.
Now in form lets enter the name, email, phone and click on submit.
After submitting the form in console you can see here the name,email and phone.
So in this way you can use form in react.