Created
August 21, 2018 11:37
-
-
Save kdipaolo/dad42a6e64c43d479dd43a5de865f519 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react' | |
// With apollo mutations you are able to access the link state from within a second argument in a mutation render prop | |
export default class App extends Component { | |
render() { | |
return ( | |
<Mutation mutation={UPDATE_POST}> | |
{(updatePost, result) => { | |
// Here | |
const onSuccess = () => result.client.writeData({data: isEditMode: false) | |
return <PostForm post={post} onSubmit={updatePost} onSuccess={onSuccess} /> | |
}} | |
</Mutation> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment