Set Properties on Child Components
Let’s look at how the owner,
c-todo-app, sets public properties on the two instances of
@api decorator exposes the
itemName field as a public property.
To set the public
todoApp.html sets the
item-name attribute on each
item-name attribute in markup maps to the
This example uses static values of
Bread, but a real-world component would typically use a
For a slightly more complicated example, see the composition basics recipe in the lwc-recipes repo.
You can also play with similar code in a playground at lwc.dev, which is the Lightning Web Components: Open Source developer site.