In this video we are going to learn about changing state.
So lets see how to change the state.
So go to project and open post component.
Inside the post component lets create a button and add the onClick event here.


<button onClick={} >Change State</button>


Now create a function for changing the state.


handleChangeState=(e)=>{
this.setState({
name:'John',
age:28
});
}


Now add this function to the onClick event.


<button onClick={this.handleChangeState} >Change State</button>


Now lets check.
So switch to the browser and go to url localhost:3000.
You can see the button.
Now just click on this button.
You can see the state has been change.
See the name and age which are changed.
Now lets change state skill property.
For that switch to the project and inside the handleChangeState just write.


handleChangeState=(e)=>{
this.setState({
name:'John',
age:28,
skills:['php','java','nodejs']
});
}


Now save the file and lets check.
So switch to the browser and now lets click on button.
You can see the skills has been changed.
So in this way can change the state in react.