I get tripped up forgetting to add return state to the end of my action handlers, and it's a horrible and hard to figure out issue when suddenly part or all of your state is missing.
I propose simply checking if typeof state === 'undefined' and not changing the state if it is undefined. To wipe the state, one can return null or return {} or something.
Any opinions? Concerns?
I get tripped up forgetting to add
return stateto the end of my action handlers, and it's a horrible and hard to figure out issue when suddenly part or all of your state is missing.I propose simply checking if
typeof state === 'undefined'and not changing the state if it is undefined. To wipe the state, one canreturn nullorreturn {}or something.Any opinions? Concerns?