Advantages of class components
- State Access: Class components have access to a state that determines the current behavior and appearance of the component.
- setState() Function: The state in class components can be modified using the
setState()
function. - Multiple Modifications: One or more variables, arrays, or objects defined in the state can be modified simultaneously using the
setState()
function.
What are Class Components in React?
React class components are the bread and butter of most modern web apps built in ReactJS. These components are simple classes (made up of multiple functions that add functionality to the application) and are based on the traditional class-based approach. All class components are child classes for the Class Component of ReactJS.