shane
09/05/2018, 4:14 PMconst MUTATION_STRING = isCancel ? MANAGE_ACCOUNT_MUTATION : DELETE_USER_MUTATION
const mutationFunc = isCancel ? updateUser : deleteUser // <-- in theory what I'd like to do
return (
<Mutation
mutation={MUTATION_STRING}
>
{/* v--- then call that conditional mutate function based on the MUTATION_STRING */}
{(mutationFunc, { loading, error }) => (...)}
kratam
09/05/2018, 5:46 PMMUTATION_STRING
a simple string or a gql mutation? The const mutationFunc
part is not required, it'll be passed to the render function automatically (depending on the MUTATION_STRING
)shane
09/05/2018, 5:54 PMshane
09/06/2018, 7:53 PM