Get the latest tech news
Lucy: A concise language for describing Finite State Machines
{ toggle => disabled } initial state disabled { toggle => enabled } import { createMachine } from 'xstate'; export default function() { return createMachine({ initial: 'disabled', states: { enabled: { on: { toggle: 'disabled' } }, disabled: { on: { toggle: 'enabled' } } } }); } See the install page for detailed instructions on the various ways you can use Lucy, such as with popular JavaScript build tools. To use the command-line compiler install with: curl -sSf https://lucylang.org/install.sh |.
import{ createMachine }from'xstate';exportdefaultfunction(){returncreateMachine({ initial:'disabled', states:{ enabled:{ on:{ toggle:'disabled'}}, disabled:{ on:{ toggle:'enabled'}}}});}
Or read this on Hacker News