Apollo Elements Apollo Elements Guides API Blog Toggle darkmode

Class Mixins: ApolloClientMixin

Mixin which associates an ApolloClient instance with a custom element class.

See Usage: Apollo Client for examples and alternatives.

import { ApolloQueryElement } from '@apollo-elements/interfaces';
import { ApolloClientMixin } from '@apollo-elements/mixins/apollo-client-mixin';
import { createApolloClient } from '@apollo-elements/core/lib/create-apollo-client';

const client = createApolloClient({ uri: '/graphql' });

export class WithClientElement extends
  ApolloClientMixin(ApolloQueryElement, client) { }

Mixin which applies a specific ApolloClient instance to the element.

Signature

ApolloClientMixin

Mixin which applies a specific ApolloClient instance to the element.

Parameters

client

ApolloClient<NormalizedCacheObject>

The specific ApolloClient instance.

superclass

B

An element that implements the ApolloElementInterface.

Properties

client

ApolloClient<NormalizedCacheObject>

The client specified with ApolloClientMixin.

Exports

import { ApolloClientMixin } from '@apollo-elements/mixins/apollo-client-mixin';