site/tutorials - Added extra explanation for object reactivity

pull/3863/head^2
Fox 5 years ago committed by GitHub
parent 20451658c1
commit b750aaa46d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -30,3 +30,12 @@ function addNumber() {
numbers[numbers.length] = numbers.length + 1; 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:
```js
const childRef = obj.foo;
childRef.bar = "new value";
```
And to make it work it would be needed to force an update to object with `obj = obj`.

Loading…
Cancel
Save