If you are not reassigning record
in the child – i.e., you are not doing something like this.record = newRecord;
– then what you have should work fine.
Since you are passing a JavaScript reference type (an object) to the child, any changes you make to the properties of the object in the child – e.g., this.record.property1 = someNewValue;
– will be "seen" by the parent because both the parent and the child have a reference to the same record
object. There is only one record
object that is being manipulated.
If you are reassigning record
in the child (or if record
was instead a primitive type such as an integer, string, or boolean), then see @Günter's answer. In this case, there are multiple record
objects involved, so you have to tell the parent when the child starts using a new object.