Differentiate between stateless and stateful components.
The difference between stateless and stateful components are:
| SN | Stateless Component | Stateful Component |
|---|---|---|
| 1. | The stateless components do not hold or manage state. | The stateful components can hold or manage state. |
| 2. | It does not contain the knowledge of past, current, and possible future state changes. | It can contain the knowledge of past, current, and possible future changes in state. |
| 3. | It is also known as a functional component. | It is also known as a class component. |
| 4. | It is simple and easy to understand. | It is complex as compared to the stateless component. |
| 5. | It does not work with any lifecycle method of React. | It can work with all lifecycle method of React. |
| 6. | The stateless components cannot be reused. | The stateful components can be reused. |
