DEV Community


A Login Form built using React Hooks

creativesuraj profile image Suraj Sharma Updated on ・1 min read

Created a simple login form using React, Typescript and React Material UI featuring useReducer and useEffect hooks.

Login Form

A detailed article on How to build a React Login Form with Typescript and React hooks

Discussion (3)

Editor guide
jrbell989 profile image
Jason Bell

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.

fantasticsoul profile image

you can also refactor your from with concent, it is worth doing.
here is 2 demos:
js ver:
ts ver:

creativesuraj profile image
Suraj Sharma Author

Sure, I will look into it.