idev0085 / react-boilerplate

0 stars 0 forks source link

What are stateful components? #59

Open idev0085 opened 3 years ago

idev0085 commented 3 years ago

In React, a stateful component is a component that holds some state. Stateless components, by contrast, have no state. Note that both types of components can use props. In the example, there are two React components. The Store component is stateful and the Week component is stateless.

Stateless components are simple functional component without having a local state but remember there is a hook in react to add state behavior in functional component as well. Stateful component can contains the state object and event handling function, user actions as well