Manage the state in the parent and provide to children templates is very often something that needs to be handled in frontend applications.
In React there is a standard called “Lift up the state” and this approach is also adopted in other frontend libraries/frameworks.
To make the code easier we can use some utilities:
// utility code