Stateful component:
- A component that manages the state in class-based with state or functional with useState.
- In some component, the data keeps changing, for example, watching the cricket score etc.
- In most of the cases, the class-based components extend react component.
- Stateful components can use react life cycle hooks
- In stateful components it good to use the this instance
Stateless component:
- A component that has no internal state management in it.
- In some component, the data remains the same, for example, showing the static data.
- Function components are simply functions that receive the props and return the JSX code.
- Stateless components can not use the react life cycle hooks
- Here need not to use this instance, they just receive the props as an argument
Top comments (0)