• /
  • Log in

NerdGraphMutation

A generic NerdGraph mutation component that allows you to mutate anything from NerdGraph.

Usage

import { NerdGraphMutation } from 'nr1'

Examples

Props

childrenrequiredfunction

Render prop function as children.

function (
mutate: function, //

Function to trigger a mutation from your UI.

mutationResult: MutationResult //

Results of the mutation.

) => React.ReactNode
mutationrequiredstring|object

GraphQL mutation, either as a string or a GraphQL document parsed into an AST by graphql-tag.

variablesobject
DEFAULT
{}

Object containing all of the variables your mutation needs to execute.

Methods

NerdGraphMutation.mutate

Static method to use NerdGraphMutation as a Promise instead of as a React component.

function (
props: Object //

Object containing the mutation options. Any NerdGraphMutation prop is a valid option except children.

) => PromiseQueryResult

Type definitions

PromiseQueryResult

{
error: ApolloClient.ApolloError, //

Runtime error with graphQLErrors and networkError properties.

data: Object, //

Object containing the result of your query.

fetchMore: function|null, //

If not null, fetchMore allows you to load more results for your query. New data is merged with previous data.

refetch: function, //

Refetch the query.

}

MutationResult

{
loading: boolean, //

Indicates that the request is in flight.

error: ApolloClient.ApolloError, //

Runtime error with graphQLErrors and networkError properties.

data: Object, //

Object containing the result of your mutation.

}
Create issueEdit page
Copyright © 2021 New Relic Inc.