State in React JS is an object that stores the prop values of the components and can store as many properties as we want.
Here is an example of State in React JS
class Car extends React.Component {
constructor(props) {
super(props);
this.state = {
brand: “Ferrari”
year: “1992”
color: “silver”
};
}
render() {
return (
<div>
<h1>My Car Details</h1>
</div>
);
}
}
If you are interested in web development, you can enroll these Web development courses by Intellipaat
You can watch this video on React JS course for beginners to learn about State with example in React JS: