apollo-elements/apollo-elements

View on GitHub
docs/api/core/helpers/decorators.md

Summary

Maintainability
Test Coverage
---
layout: layout-api
package: '@apollo-elements/core'
module: decorators.js
description: Property Decorators for Apollo Elements
---
<!-- ----------------------------------------------------------------------------------------
     Welcome! This file includes automatically generated API documentation.
     To edit the docs that appear within, find the original source file under `packages/*`,
     corresponding to the package name and module in this YAML front-matter block.
     Thank you for your interest in Apollo Elements 😁
------------------------------------------------------------------------------------------ -->

# Core >> Helpers >> Decorators || 50

Decorators for Apollo Elements. Used internally to reflect properties from controllers to their elements. Normally you shouldn't need to import these directly.

```ts
import { controlled } from '@apollo-elements/core/decorators';

class ControlledData<D, V = VariablesOf<D>> extends LitElement {
  controller = new ApolloQueryController<D, V>(this);

  @controlled()
  @state()
  data: Data<D> | null = null;
}
```