Which component should be included in the states ??!

In React, we have a lots of component that is placed in the form of parent and child.
Now the question that arises
Which component should be included in the states ??!
Component higher or lower?
.
Let me first explain the state
States specify the status of the application
For example, if you click on a button and a page opens and the status of the application has changed, it means that one of the states has changed.
.
Now the answer to the question is that there is a general rule
That is, if you need to read or even change the state in the higher-order component , you must define it in the higher-order component.
Of course, there are exceptions to this rule, but it helps a lot
.

Amirprogrammer
Amirprogrammer

No responses yet