State Hoisting
As the application grows you will realise that some components will need common data or actions in one component may need to cause another component to re-render as well.
Let take a look the example below.
As the example above you are encouraged to lift state up, if two components need to act on the same data or need to use the same callback.
So you should create a common ancestor in this common ancestor and then use the state to manage all the data and callbacks that children will use in rendering as following.