installing xstate code example Example: xstate install npm install xstate if you are using yarn: yarn add xstate