Last active
January 17, 2023 20:36
-
-
Save fauxparse/b42dd4d0903984fe9845c1206265ef48 to your computer and use it in GitHub Desktop.
Revisions
-
fauxparse revised this gist
Jan 17, 2023 . 1 changed file with 7 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,22 +1,24 @@ const Machine = createMachine({ context: { name: '', }, schema: { context: {} as { name: string }, }, states: { A: { on: { NEXT: 'B', }, }, B: { context: { count: 0, }, schema: { context: {} as { count: number }, }, }, }, initial: 'A', }); -
fauxparse created this gist
Jan 17, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ const Machine = createMachine({ context: { name: '' }, schema: { context: {} as { name: string } }, states: { A: { on: { NEXT: 'B' }, }, B: { context: { count: 0, }, schema: {} as { count: number } } }, initial: 'A', }); // ... const service = interpret(Machine); service.state.context // { name: '' } service.send('NEXT') service.state.context // { name: '', count: 0 }