TRY THIS PROMPT
THE STRUCTURED ACTION IT BECOMES
{
"action": "add_asset",
"asset": "dragon",
"row": 2,
"column": 3
}WHAT THE ENGINE EFFECTIVELY RUNS
// The reducer that handles add_asset
function reducer(state, action) {
if (action.action === "add_asset") {
return {
...state,
assets: [
...state.assets,
{
id: crypto.randomUUID(),
asset: action.asset,
row: action.row,
column: action.column,
},
],
};
}
return state;
}CHALLENGE
Place a coin at row 0, column 0 and a key at row 7, column 7. What changes in the assets array?