3 ms·
No, I genuinely don't understand why people hate switch statements :) Like I said in the post, a switch statement is a construct designed to implement if/else
by acemarke 9y ago
No, I genuinely don't understand why people hate switch statements :) Like I said in the post, a switch statement is a construct designed to implement if/else logic on the value of a single field, and since we usually want to do work based on the value of `action.type`, a switch statement is the obvious choice.
Now, I personally tend to use a function map utility in my own Redux code, but there's definitely nothing _wrong_ with switch statements, and I don't get the vehement complaints about them.