You break out of the switch statement by using return. So there is no need for break here.
If you were to use break like this, you wouldn’t return any value, because you exit before returning the value.
case "LOGOUT":
break;
return {
authenticated: false
};
In this case on the other hand, break is unreachable code - it will never be called - because you return something - and by doing that you exit the switch statement.
case "LOGOUT":
return {
authenticated: false
};
break;
Thank you for the answer!
so adding break here should have no harm since it is unreachable anyways, right?
I am just wondering why Hint1 says “don’t use break commands” here, which sounds a big thing to watch out.
It leads me to think that having “break” here could change the functionality… but in fact, it doesn’t matter.
It would cause no harm - yes, in the sense that it is not going to break your program. But just like @ILM said, if this code is not going to be used, there is no point writing it