Skip to content

Commit 0d76efd

Browse files
committed
Fix example for composition api reactivity
The filtered arrays are now wrapped in a computed properties so that they maintain their reactivity.
1 parent 2813d86 commit 0d76efd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/composition-api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ export default {
191191
})
192192
const { items: todos } = useFind({ model: Todo, params: todosParams })
193193
// Notice the "todos.value"
194-
const completeTodos = todos.value.filter(todo => todo.isComplete)
195-
const incompleteTodos = todos.value.filter(todo => !todo.isComplete)
194+
const completeTodos = computed(() => todos.value.filter(todo => todo.isComplete))
195+
const incompleteTodos = computed(() => todos.value.filter(todo => !todo.isComplete))
196196
197197
return {
198198
todos,

0 commit comments

Comments
 (0)