@twilio/flex-sdk
    Preparing search index...

    Variable useDataClientMutationConst

    useDataClientMutation: typeof useMutation = useMutation

    A hook for executing mutations in an Apollo application. Refer to the Mutations section for a more in-depth overview of useMutation.

    A GraphQL mutation document parsed into an AST by gql.

    Options to control how the mutation is executed.

    A tuple in the form of [mutate, result]

    import { gql, useDataClientMutation } from '\@twilio/flex-sdk/data-client';

    const ADD_TODO = gql`
    mutation AddTodo($type: String!) {
    addTodo(type: $type) {
    id
    type
    }
    }
    `;

    function AddTodo() {
    let input;
    const [addTodo, { data }] = useDataClientMutation(ADD_TODO);

    return (
    <div>
    <form
    onSubmit={(e) => {
    e.preventDefault();
    addTodo({ variables: { type: input.value } });
    input.value = '';
    }}
    >
    <input
    ref={(node) => {
    input = node;
    }}
    />
    <button type="submit">Add Task</button>
    </form>
    </div>
    );
    }