🎉 berenickt 블로그에 온 걸 환영합니다. 🎉
Memo
Error
Error-Next-GraphQL-MutationTuple<any, OperationVariables, DefaultContext, ApolloCache<any>>형식

1. graphQL TS : 오타 에러

Next-GraphQL-MutationTuple<any, OperationVariables, DefaultContext, ApolloCache<any>>형식

1
export default function MyMemo() {
2
// **** PlayGround
3
const { data } = useQuery(FETCH_POST_MEMOS)
4
5
// 💥 에러)
6
// MutationTuple<any, OperationVariables, DefaultContext, ApolloCache<any>>' 형식에
7
// 'deletePostMemo' 속성이 없습니다.
8
// 해결 -> {}를 []로 고치기 (오타)
9
// const {deletePostMemo} = useMutation(DELETE_POST_MEMO)
10
const { deletePostMemo } = useMutation(DELETE_POST_MEMO)
11
12
// **** 저장된 메모 단일 삭제
13
const onClickDeleteMemo = async (event: MouseEvent<HTMLButtonElement>) => {
14
try {
15
await deletePostMemo({
16
variables: {
17
memoId: event.currentTarget.id,
18
},
19
refetchQueries: [{ query: FETCH_POST_MEMOS }],
20
})
21
Modal.success({ content: '메모가 삭제되었습니다.' })
22
} catch (error) {
23
if (error instanceof Error) Modal.error({ content: error.message })
24
}
25
}
26
27
// prettier-ignore
28
return (
29
<MyMemoUI
30
data={data}
31
onClickDeleteMemo={onClickDeleteMemo}
32
/>
33
)
34
}