From 2cff1e2589bb313385c010363ca5ac5e2baae4e5 Mon Sep 17 00:00:00 2001 From: Abbas Date: Wed, 31 Dec 2025 10:01:00 +0530 Subject: [PATCH] Update instructions/lwc.instructions.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- instructions/lwc.instructions.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/instructions/lwc.instructions.md b/instructions/lwc.instructions.md index 3675b0da..d146b560 100644 --- a/instructions/lwc.instructions.md +++ b/instructions/lwc.instructions.md @@ -170,33 +170,33 @@ export default class MyComponent extends LightningElement { // @track is NOT needed for simple property reassignment // This will trigger reactivity automatically: handleUpdate() { - this.simpleValue = 'updated'; // Reactive without @track - this.count++; // Reactive without @track + this.simpleValue = 'updated'; // Reactive without @track + this.count++; // Reactive without @track } // @track IS needed when mutating nested properties without reassignment @track complexData = { - user: { - name: 'John', - preferences: { - theme: 'dark' + user: { + name: 'John', + preferences: { + theme: 'dark' + } } - } }; handleDeepUpdate() { - // Requires @track because we're mutating a nested property - this.complexData.user.preferences.theme = 'light'; + // Requires @track because we're mutating a nested property + this.complexData.user.preferences.theme = 'light'; } // BETTER: Avoid @track by using immutable patterns regularData = { - user: { - name: 'John', - preferences: { - theme: 'dark' + user: { + name: 'John', + preferences: { + theme: 'dark' + } } - } }; handleImmutableUpdate() {