Completing todo items
The last piece of this application is rendering each todo item and providing the ability to change the status of the todo in the Todo
component in src/components/Todo.js
. Let's look at pieces of this code:
import classnames from 'classnames'; import { useMutation } from '@apollo/client'; import { CHANGE_TODO_STATUS, REMOVE_TODO, GET_USER, } from '../constants'; function Todo({ todo }) { const [changeTodoStatus] = useMutation(CHANGE_TODO_STATUS, { refetchQueries: [{ query: GET_USER, variables: { userId: 'me' } }], }); const [removeTodo] = useMutation(REMOVE_TODO, { refetchQueries: [{ query: GET_USER, variables: { userId: 'me' } }], }); const handleCompleteChange = (e...