Skip to content

Instantly share code, notes, and snippets.

@acorcutt
Created May 24, 2017 14:52
Show Gist options
  • Save acorcutt/478d1cc778b2ade1d055ff7bb764b342 to your computer and use it in GitHub Desktop.
Save acorcutt/478d1cc778b2ade1d055ff7bb764b342 to your computer and use it in GitHub Desktop.
ApolloClient writeFragment
inputChange = (e) => {
console.log('inputChange', e.currentTarget.name, e.currentTarget.value );
this.props.apolloClient.writeFragment({
id: 'new', //this.props.profileQuery.Profile.id,
fragment: gql`
fragment Profile on Profile {
__typename
${e.currentTarget.name}
}
`,
data: {
"__typename": "Profile",
[e.currentTarget.name]: e.currentTarget.value,
},
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment