Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@connect({
mapMutationsToProps: ({ state }) => {
return {
saveBookmark: (...) => ({
mutation: graphql`
mutation createBookmark($bookmarkInputParam: bookmarkInput){
createBookmark(bookmarkInfo: $bookmarkInputParam)
{ <= this is the data I want to get to
uuid
...
}
}
`
}}}
export default class Viewer extends Component {
static propTypes = {
...
mutations: PropTypes.object
};
constructor(props) {
super(props);
this.state = {
bookmark: null
};
}
loadBookmark = (bookmarkObj) => {
this.setState({ bookmark: bookmarkObj });
};
saveBookmark = (bookmarkObj) => {
const createdBookmark = this.props.mutations.saveBookmark( <== this returns an object that contains the data,
but wrapped in an object with various _private properties
bookmarkObj.description, bookmarkObj.zoom, bookmarkObj.centeredNode
);
// this.loadBookmark(createdBookmark); <== this is what I want to do
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.