
When logging in or creating an account for a website or application, it is useful for a user to be able to see their password, especially when pass...
For further actions, you may consider blocking this person and/or reporting abuse
Hi, I like this article it shows common feature, well explained and well executed. That's exactly what people starting off with React need. If I had this as an interview submission I would have invite you for second round 👍
Here are couple of tips to explore:
Icon
proptype
value as a state is a bit unnecessary. I would recommend using something likeisVisible
and have it as a boolean value. You could then dosetIsVisible(!isVisible)
and do ternary on type propsetState
callback - gives you something new to explore :)button
instead of aspan
for the toggle. That way it will be easier to use for people with screen readersAbove will be a nice exploration for you to do on this feature. Well done for your solution though!
Thank you for your feedback! I will look into these options!
Awesome! It is super simple, Please do checkout this package,
npmjs.com/package/react-password-t...
Using this you can reduce code and also it doesn't use useState instead it's using useRef hook so it makes it more performant in terms of re-rendering.
This was super helpful
Instead of using a state for the icon I would suggest to use the ternary operator in javascript. Great article tho!
Super Simple! And nice writing,,, ♥️
Hey Anna — great article. Super simple to follow. Out of curiosity, were there any challenges you faced while building this feature? Or anything unexpected you have to accomodate for? :)
I used Tailwind CSS to style the components and getting the eye icons to be correctly positioned was difficult!
Gotta love those usestates, simple and straight to the point! Thank for this
Thank you, I could create my own version of this using your code. Thanks a lot!
Thank you! It was a great article.