Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jun 25, 2020
1 parent 91bb344 commit 6e4e949
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,26 +160,27 @@ b.list[0].count.value === 0 // true

<details>
<summary>
<b>Should</b> always use <code>ref</code> in a <code>reactive</code> when working with <code>Array</code>
<b>Should</b> always use <code>ref</code> in a <code>reactive</code> when working with <code>Array</code>
</summary>

```js
const a = reactive({
count: ref(0),
})
const b = reactive({
list: [a],
list: [
reactive({
count: ref(0),
})
],
})
// unwrapped
b.list[0].count === 0 // true
a.list[0].count === 0 // true

b.list.push(
a.list.push(
reactive({
count: ref(1),
})
)
// unwrapped
b.list[1].count === 1 // true
a.list[1].count === 1 // true
```

</details>
Expand Down

0 comments on commit 6e4e949

Please sign in to comment.