You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason for this is because the useMutation() hook can't be called conditionally or in a function (rules of hooks) & hence it seems to me like i need to define the number of actions in advance in order to call the mutation instances like so
This is obsviously really ugly and was just a quick solutation at first, but after a week im still stuck at this solution because I can't figure out how to adapt the number of useMutation() instances to the number of action arguments
This also leads to a dispatch function that looks like this
I think that the if statement is neccessary in order to supply the right action to the updateState function but again, I need some type of for-loop/mapping instead of these hardcoded mutations so that you can dynamically input any number of actions to useTrpcReducer and call updateState for every action argument.
Do we have any ideas on how to go about this?
The text was updated successfully, but these errors were encountered:
Currently the
useTrpcReducer
hook takes in a arbitrary amount of actionsThe reason for this is because the
useMutation()
hook can't be called conditionally or in a function (rules of hooks) & hence it seems to me like i need to define the number of actions in advance in order to call the mutation instances like soThis is obsviously really ugly and was just a quick solutation at first, but after a week im still stuck at this solution because I can't figure out how to adapt the number of useMutation() instances to the number of action arguments
This also leads to a
dispatch function
that looks like thisI think that the if statement is neccessary in order to supply the right action to the
updateState
function but again, I need some type of for-loop/mapping instead of these hardcoded mutations so that you can dynamically input any number of actions touseTrpcReducer
and callupdateState
for every action argument.Do we have any ideas on how to go about this?
The text was updated successfully, but these errors were encountered: