undefined is not an object (evaluating 'response.data')

Viewed 650

I am using react native.

This is my graphql query

    const test = gql`
      mutation Test($param: Int) {
        test(param: $param) {
           id
          }
      }
    `;

this is the mutation in my render method of my component:

export default class Screen1 extends React.Component {

render() {
     <Mutation mutation={test}>
                   {(addPoi, { data }) => (
                        <Button
                          onPress={() => {
                            addPoi({variables: {param: 1})
                            }}>
                        </Button>
                      )
                   }
    </Mutation>

}}

I just keep getting the error when i click my button. but all of my <Query> works. I think the error is inside the apollo itself. my resolvers in my graphql server never execustes. the query above is tested in graphql playground and it works.

0 Answers
Related