A developer is working with a Lightning Web Component and needs to ensure reactive updates occur when an object property or array element changes inside a tracked property. What is the correct approach in modern LWC?
Lightning Web Components use a shallow reactivity track for properties decorated with `@track`. When mutating nested properties of an object or elements within an array, the framework does not automatically detect deep mutations because observing every nested level would degrade runtime performance. Reassigning the entire object reference forces the component's reactive engine to evaluate the change and trigger a re-render, directly satisfying the requirement for reactive updates when internal properties of a tracked object or array shift.
Why this answer
Assigning a new object or array reference (mutation via replacement) triggers reactivity in LWC tracked properties.