Apollo Elements Apollo Elements Guides API Blog Toggle darkmode

Class Mixins: ApolloClientMixin

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

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

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

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

Exports

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

Signature

ApolloClientMixin

Mixin which applies a specific ApolloClient instance to the element.

Parameters

superclass

Constructor<ApolloElement>

client

ApolloClient<NormalizedCacheObject>

The specific ApolloClient instance.

Returns

Constructor<ApolloElement>

Properties

client

ApolloClient<NormalizedCacheObject>

The specified client