Horje
apollo client mutation without component Code Example
apollo client mutation without component
// react-apollo includes two HOCs called graphql() and withApollo() that can be used to accomplish this.
// This example takes the withApollo() HOC approach

import React, { Component } from "react";
import { DO_MUTATION } from "./mutations";
import { withApollo } from "react-apollo";

import SomeLibrary from "SomeLibrary";

export class MyComponent extends Component {
    render() {
        return (
            <Button
                onPress={() => {
                    SomeLibrary.addListener(this.listenerHandler);
                }}
            />
        );
    }

    listenerHandler = () => {
        this.props.client.mutate({
            mutation: DO_MUTATION,
            variables: {
                some_var: "some_val",
            },
        });
    };
}
export default withApollo(MyComponent);




Javascript

Related
is there an api for netflix shows Code Example is there an api for netflix shows Code Example
jquery get data attribute value by class Code Example jquery get data attribute value by class Code Example
Circular Queue in javascript Code Example Circular Queue in javascript Code Example
javascript if return true false Code Example javascript if return true false Code Example
alert library css and js Code Example alert library css and js Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7