I've found that when using multiple useState hooks, it becomes easier to move to useReducer, especially when conditions mutate multiple pieces of state. I think useState still works well in your example, but once you build a more complex login (with 2FA, requiring a new user to set a new password, etc), it can get messy quickly.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I've found that when using multiple
useState
hooks, it becomes easier to move touseReducer
, especially when conditions mutate multiple pieces of state. I thinkuseState
still works well in your example, but once you build a more complex login (with 2FA, requiring a new user to set a new password, etc), it can get messy quickly.