Is it only possible to update a sibling component through a parent?

Question

Is it only possible to update a sibling component through a parent?

Answer

Unless we use a state management library like Redux, the only way to update components from sibling to sibling is through the parent component. Let’s remember that children components are like branches from the parent:

                               child1
                              /
                             /
                            /
                        Parent
                            \
                             \
                              \
                               child2

Therefore, the only connexion they have with each other is through the parent, and so most commonly you will see the parent holding state and methods to manipulate that state, then using one child to display that state, and the other to manipulate that state.

                           ,>  child1
                          /   /
                       state /
                         |  /
                        Parent
                         |  \
                      method \
                          \   \
                           `>   child2

Fantastic drawing skills. :slight_smile:

9 Likes