|
|
|
|
|
by andrewstuart
3752 days ago
|
|
My (beginner level) understanding is that if you move the state up to a higher level then you can generalise the component. For example a button's state can be controlled by a higher level container component and that state might include variables such as "buttonTitle" = "Hit delete to continue", and onDelete = deleteCustomerRecord. So the core button code can be used in a variety of contexts. If I'm wrong maybe someone else will correct me. |
|
But then again, maybe it just hasn't 'clicked' with me yet.
Edit: I should say though that having all state external would help in testing the component since you can now simulate every possible state without going into the internals of the component itself.