Suppose I have a
my-list and a
my-list-item components with the obvious relationship: an instance of
my-list contains a list of
my-list-item instances. The
data object of
my-list contains a list
items of data entries, each rendered as a
my-list-item component instance.
There is a method
my-list which appends a new data entry to
items, causing a new instance of
my-list-item to be created / rendered.
What is the recommended way to finetune (manipulate) the newly created item? How can one get a reference to the item’s component instance?
The solution presented in the above jsfiddle is to attach a callback (named
onCreated) to the item’s data entry which gets called (and removed) in the
created hook of
my-list-item. Is this an acceptable practice? What is the recommended solution?