Code smell: Setting state twice in a row Example: Solution: Eliminate...
Code smell: Setting state twice in a row
Example:
Solution: Eliminate showDialog state. Derive state instead.
If userToEdit has a value, show the dialog.
If userToEdit is null, hide the dialog.
Benefits:
-Less state to manage
-Avoids illogical combinations (it's illogical for userToEdit to be null when showDialog is true).
