Dispatching more than one payload
The action creators generated by Redux Toolkit's createSlice
API only take a single argument as their payload by default. If you need to pass in multiple values, you must put them all inside an object, like dispatch(todoAdded({text: 'Buy Milk', completed: false}))
.
Given that, the code that you've got looks valid atm. It would help if you could show what the nameUpdate
function is, but I suspect that it's actually returning undefined
or similar.