Gluon: ApolloQuery
ApolloQuery
inherits from ApolloElement
and implements the ApolloQueryInterface
.
Demo
import { ApolloQuery, html } from '@apollo-elements/gluon';
import { gql } from '@apollo/client/core';
import '@apollo-elements/components/apollo-client';
class SpacexLaunches extends ApolloQuery {
constructor() {
super();
this.variables = { limit: 3 };
this.query = gql`
query LaunchesQuery($limit: Int) {
launchesPast(limit: $limit) {
id
mission_name
links { mission_patch_small }
}
}
`;
}
get template() {
const launches = this.data?.launchesPast ?? [];
return html`