hoangvu12 – 03-00 Jan 23

I'm using XState to make a Blackjack game, now I want to make the dealer reveal any player's cards, but the problem is I don't know how to pass params (that input from the dealer) to the action. Here is the dealer state:
dealerTurn: {
on: {
HIT: {
target: 'checkDealerStatus',
actions: {
type: 'dealCardsToDealer',
},
},
REVEAL: {
target: 'checkNumberOfPlayersLeft',
actions: {
type: 'revealAPlayerCards',
params: {
playerId: "The player id that user want to reveal" // <-- How can I pass the player ID here?
}
},
},
REVEAL_ALL: {
target: 'revealAllPlayersCards',
},
},
},
dealerTurn: {
on: {
HIT: {
target: 'checkDealerStatus',
actions: {
type: 'dealCardsToDealer',
},
},
REVEAL: {
target: 'checkNumberOfPlayersLeft',
actions: {
type: 'revealAPlayerCards',
params: {
playerId: "The player id that user want to reveal" // <-- How can I pass the player ID here?
}
},
},
REVEAL_ALL: {
target: 'revealAllPlayersCards',
},
},
},
Edit: Solved this by adding a custom property to event
S
S3BAS114d ago
Wajo an xstate question here Which version are you using?
UU
Unknown User112d ago