+ ${this.fetchController.snapshot.matches('idle')
+ ? html`
+
+ `
+ : ''}
+ ${this.fetchController.snapshot.matches('loading')
+ ? html`
Loading...
`
+ : ''}
+ ${this.fetchController.snapshot.matches('success')
+ ? html`
+
+ Success! Data:
+
+ ${this.fetchController.snapshot.context.data}
+
+
+ `
+ : ''}
+
+ `;
+ }
+}
+
+window.customElements.define('use-actor', UseActor);
+
+declare global {
+ interface HTMLElementTagNameMap {
+ 'use-actor': UseActor;
+ }
+}
diff --git a/packages/xstate-lit/test/UseActorRef.ts b/packages/xstate-lit/test/UseActorRef.ts
new file mode 100644
index 0000000000..beabd1ba7f
--- /dev/null
+++ b/packages/xstate-lit/test/UseActorRef.ts
@@ -0,0 +1,52 @@
+import { html, LitElement } from 'lit';
+import { createMachine } from 'xstate';
+import { UseMachine } from '../src/index.ts';
+
+const machine = createMachine({
+ initial: 'inactive',
+ states: {
+ inactive: {
+ on: {
+ TOGGLE: 'active'
+ }
+ },
+ active: {
+ on: {
+ TOGGLE: 'inactive'
+ }
+ }
+ }
+});
+
+export class UseActorRef extends LitElement {
+ machineController: UseMachine