Skip to content

Commit

Permalink
checking out .meta
Browse files Browse the repository at this point in the history
  • Loading branch information
technoplato committed Apr 9, 2024
1 parent 5b12ad8 commit 9f2ddcd
Showing 1 changed file with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,45 @@
it('works', () => {});
import { createActor, createMachine } from 'xstate';

it('meta', () => {
const feedbackMachine = createMachine({
id: 'feedback',
initial: 'prompt',
meta: {
title: 'Feedback',
},
states: {
prompt: {
meta: {
content: 'How was your experience?',
},
},
form: {
meta: {
content: 'Please fill out the form below.',
},
},
thanks: {
meta: {
content: 'Thank you for your feedback!',
},
},
closed: {},
},
});

const feedbackActor = createActor(feedbackMachine).start();

console.log(feedbackActor.getSnapshot().getMeta());
// logs the object:
// {
// feedback: {
// title: 'Feedback',
// },
// 'feedback.prompt': {
// content: 'How was your experience?',
// }
// }
});
// import {
// ActorRef,
// Snapshot,
Expand Down

0 comments on commit 9f2ddcd

Please sign in to comment.