xstate conditional code example
Example: xstate state based on condition
on:{
EVENT_NAME:[
// it goes to the first target that passes the cond(short for condition)
{ target: 'opened', cond: 'isAdmin' },
{ target: '.error', cond: 'shouldAlert' }]
}