I wanted to avoid having more actions than was necessary. The first solution was an action for each input and the other a single action to handle them all. The second solution is better because it make the code easier to read and follow. If there's a problem with the logic, I'd just have to look under a single action to debug.
Which is the heavy operation we are trying to avoid and how does one solution handle it better than the other? 😵💫
I wanted to avoid having more actions than was necessary. The first solution was an action for each input and the other a single action to handle them all. The second solution is better because it make the code easier to read and follow. If there's a problem with the logic, I'd just have to look under a single action to debug.
By heavy do you mean time/space complexity? If so, I couldn't really say, but what I did was geared more towards readability.