未定义不是对象(正在评估“ response.data”)

时间:2019-06-23 14:03:58

标签: react-native apollo react-apollo apollo-client

我正在使用本机反应。

这是我的graphql查询

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

这是我的组件的render方法中的变异:

export default class Screen1 extends React.Component {

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

}}

单击按钮时,我只会不断收到错误消息。但我所有的<Query>都能正常工作。我认为错误是在阿波罗本身内部。我的graphql服务器中的解析器从不执行。上面的查询在graphql操场上进行了测试,并且可以正常工作。

0 个答案:

没有答案