1
這裏是我的組件:阿波羅突變沒有出現在道具
import React, { Component } from 'react';
import { gql, graphql, compose } from 'react-apollo';
export class Test extends Component {
render() {
console.log("this.props: " + JSON.stringify(this.props, null, 2));
return null;
}
}
const deletePostMutation = gql`
mutation deletePost ($_id: String) {
deletePost (_id: $_id)
}
`;
export const TestWithMutation = graphql(deletePostMutation)(Test)
這似乎是一個很簡單的例子,但是當我運行它的道具都是空的:
props: {}
看起來不錯。也許如果你返回一個空的div它的工作 –
功能在那裏。問題是JSON.stringify不顯示函數♂️。至少這個問題是一個如何去做的例子 –