What is the difference between Stateless and Stateful Component?
Stateful Component | Stateless Component |
---|---|
This stores info related to the component’s change in the state of memory. | This is used for the calculation of the internal state of components. |
Stateful components have the authority to change the state of memory. | Stateless components do not have the authority to change the state of memory. |
It contains all the info relevant to the past, present, and possible future changes in the state. | It does not contain info relevant to the past, present, and future changes in state. |
They notify stateless components regarding requirements for state change and then send down the props to them. | They receive props from the stateful components regarding state change and treat them as callback functions. |
BY Best Interview Question ON 22 Jan 2021