Skip to content

Commit

Permalink
fix(examples): correctly pass id in basic example (#311) - @erikswed
Browse files Browse the repository at this point in the history
  • Loading branch information
erikswed authored Nov 2, 2020
1 parent 2a26111 commit 87830e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions examples/basic/src/Todo.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ function Todo({ id }) {
const firestore = useFirestore()

function onDoneClick() {
return firestore.firestore()
.doc(`todos/${todo.id}`)
.update({ done: !todo.done })
const itemUpdates = {
done: !todo.done,
}
firestore.update({ collection: 'todos', doc: id } , itemUpdates)
}

return (
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/src/Todos.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function Todos() {
todoIds.map((todoId, i) => (
<Todo
key={`${todoId}-${i}`}
id={todoId}
id={todoId.id}
/>
))
}
Expand Down

0 comments on commit 87830e4

Please sign in to comment.