* fix docs

* oops

* another

* gah
pull/16411/head
Rich Harris 2 months ago committed by GitHub
parent b17557cd91
commit e5e6c0cd12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -99,12 +99,16 @@ let selected = $derived(items[index]);
If you use destructuring with a `$derived` declaration, the resulting variables will all be reactive — this...
```js
function stuff() { return { a: 1, b: 2, c: 3 } }
// ---cut---
let { a, b, c } = $derived(stuff());
```
...is roughly equivalent to this:
```js
function stuff() { return { a: 1, b: 2, c: 3 } }
// ---cut---
let _stuff = $derived(stuff());
let a = $derived(_stuff.a);
let b = $derived(_stuff.b);

@ -109,10 +109,10 @@ $effect(() => {
The same applies to array mutations, since these both read and write to the array:
```js
let array = $state([]);
let array = $state(['hello']);
$effect(() => {
array.push('hello');
array.push('goodbye');
});
```

@ -79,10 +79,10 @@ $effect(() => {
The same applies to array mutations, since these both read and write to the array:
```js
let array = $state([]);
let array = $state(['hello']);
$effect(() => {
array.push('hello');
array.push('goodbye');
});
```

Loading…
Cancel
Save