hover icon indicating copy to clipboard operation
hover copied to clipboard

Forgetting to return shouldn't wipe state

Open jesseskinner opened this issue 8 years ago • 0 comments

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?

jesseskinner avatar May 23 '17 02:05 jesseskinner