thanks much. this is my code, but i am getting an err"
Line 19:17: ‘data’ is not defined no-undef
Line 21:9: ‘loading’ is not defined no-undef
Line 22:9: ‘error’ is not defined no-undef
Line 22:44: ‘error’ is not defined no-undef
Line 27:36: ‘data’ is not defined no-undef
Line 28:16: ‘data’ is not defined no-undef
Line 30:12: ‘data’ is not defined no-undef
import React from ‘react’
import { useMutation, gql } from ‘@apollo/client’
const CREATE_REVEIW = gql`
mutation {
createReveiw(input: { data: {body:“Lorem ipsum dolor sit am”,title: “avitesttesting”, rating: 5} }) {
reveiw {
body
title
rating
}
}
}
`;
export default function AddTodo() {
const [createReveiw, { data, loading, error }] = useMutation(CREATE_REVEIW);}
console.log(data);
if (loading) return 'Submitting...';
if (error) return `Submission error! ${error.message}`;
return (
<div className="review-card">
<div className="rating">{data.reveiw.rating}</div>
<h2>{data.reveiw.title}</h2>
{data.reveiw.categories.map(c => (
<small key={c.id}>{c.name}</small>
))}
<p>{data.reveiw.body}</p>
</div>
)