Hi
can not find a way how to use react mutation with graphql and strapi.
I have used strapi to create data, and now i would like useres to add data to the fields
what is the code to add data via react to existing data collection?
for ex: i used the playground of graphql to mutate data , and its working , how could i add it as a react code?
mutation {
createReveiw(input: { data: {body:“the”,title: “avitest”, rating: 5} }) {
reveiw {
body
title
rating
}
}
}
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} }) {