Intercomponent communication in YEW

Hi Yew users,

It’s not very clear to me how inter component communication is done here. I consulted the examples and see callbacks being used. I assume that pattern is the mentioned child-to-parent (events) interaction.

How does one do parent-to-child (properties) interactions ? Is there something in example that illustrates this?

The parent can pass properties to the children, based on which they will change. So in the example given the parent communicates a colour to the child.

Thank you for taking time to answer my query. However I still do not see how any passing is going on.

There are two MyButton components in the example I think they are peers rather than parent and child.

And I do not understand how a child component can access the parent components properties. Is there something like ‘super.properties’ something like that

The child should not access the properties of the parent, because it should be a self-contained unit. It’s behaviour can change though based on it’s properties, and that is the way a parent can change it’s child components.

The example would be contained in the render function of the parent. There the parent’s components would be passed down.

1 Like