Not sure about this one...
If you have multiple source of states and each one have a name or something like data-attribute with something unique, you don't even need to know the keys from the function.
The reducer, as you added there is just another point you have to maintain.
Of course... this would be assuming you only need to do the same thing for each one.
And you could still just make { ...state, [action.type]: action.payload } maybe after filtering whatever don't fit the mold.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Not sure about this one...
If you have multiple source of states and each one have a name or something like data-attribute with something unique, you don't even need to know the keys from the function.
The reducer, as you added there is just another point you have to maintain.
Of course... this would be assuming you only need to do the same thing for each one.
And you could still just make
{ ...state, [action.type]: action.payload }maybe after filtering whatever don't fit the mold.