Share
What is a state in React?
Question
- States are the heart of React components.
- State is like a data store to the ReactJS component.
- It is mostly used to update the component when user performed some action like clicking button, typing some text, pressing some key, etc
- Basically, states are the objects which determine components rendering and behavior.
- React.Component is the base class for all class based ReactJS components. Whenever a class inherits the class React.Component it’s constructor will automatically assigns attribute state to the class with intial value is set to null. we can change it by overriding the method constructor
Leave an answer