DEV Community

Akash Sheikh
Akash Sheikh

Posted on

React — StateFull and StateLess

Stateful component:

  1. A component that manages the state in class-based with state or functional with useState.
  2. In some component, the data keeps changing, for example, watching the cricket score etc.
  3. In most of the cases, the class-based components extend react component.
  4. Stateful components can use react life cycle hooks
  5. In stateful components it good to use the this instance

Stateless component:

  1. A component that has no internal state management in it.
  2. In some component, the data remains the same, for example, showing the static data.
  3. Function components are simply functions that receive the props and return the JSX code.
  4. Stateless components can not use the react life cycle hooks
  5. Here need not to use this instance, they just receive the props as an argument

Top comments (0)