我有以下graphql突变
const CREATE_USER = gql`
mutation createUser(
userInput: {
email: String!
password: String!
}
) {
createUser(
userInput: {
email: $email
password: $password
}
) {
_id
email
}
}
`;
export default graphql(CREATE_USER, {
name: 'createUser',
props: ({createUser}) => ({
createUser:(email, password) =>
createUser({
variables: {
email,
password
}
})
})
})
导入到另一个文件,例如
import CreateUser from '../graphql/mutations/create-user/create-user';
@CreateUser
class AuthPage extends Component {
//...
}
(带有装饰器)现在,我有一个在表单提交上运行的函数,我如何告诉apollo从状态中获取一些值并使用它们来运行此突变,然后运行该突变?