DEV Community


Discussion on: 4 practices for better code

effingkay profile image
Klaudia Author

Great great points! Thank you so much for raising them, you actually picked up what I was worried about when I wrote the examples.

I have nothing else to say about your first point other than you're absolutely right. There can be some issues in the future with this code but then again - this was an artificial example just to demonstrate the point so I wasn't that worried about it

Second - redirect was a utility function actually, I dunno when I changed it but oh well, I'll go and correct it, great catch - thanks for noticing. And yes, submitHandler is harder to understand now but I think login and redirect are nice, descriptive names so you know what's happening when you're reading the code, plus both login and redirect are used in multiple places so they need to be utilities.

Thank you again for commenting!