mirror of
https://github.com/sveltejs/svelte.git
synced 2024-12-01 17:30:59 +01:00
tweak wording
This commit is contained in:
parent
98c76ec7e8
commit
1dfd42c3f4
@ -30,12 +30,12 @@ function addNumber() {
|
||||
numbers[numbers.length] = numbers.length + 1;
|
||||
}
|
||||
```
|
||||
As a rule of thumb _The name of the reactive variable must appear on the left side of the equals to react to assignments._
|
||||
|
||||
For example, this case wouldn't work:
|
||||
A simple rule of thumb: the name of the updated variable must appear on the left hand side of the assignment. For example this...
|
||||
|
||||
```js
|
||||
const childRef = obj.foo;
|
||||
childRef.bar = "new value";
|
||||
const foo = obj.foo;
|
||||
foo.bar = 'baz';
|
||||
```
|
||||
|
||||
And to make it work it would be needed to force an update to object with `obj = obj`.
|
||||
...won't update references to `obj.foo.bar`, unless you follow it up with `obj = obj`.
|
Loading…
Reference in New Issue
Block a user