password generator app

Solution retrospective
Any help or advice is appreciated.
Please log in to post a comment
Log in with GitHubCommunity feedback
- @MarziaJalili
Admiringly written! 🔥
🌟 A tiny tip to make the look gorgeous?
✅ Using a single state object can make your code cleaner and easier to manage, especially when you have many related states, man.
✅ Here's how you can refactor the all the states with a single one:
const [settings, setSettings] = useState({ length: 0, includeUpperCase: false, includeLowerCase: false, includeNumbers: false, includeSymbols: false, password: "", error: "", strength: "", copied: false, allowCopy: false, });
✅ Then, when you need to update any of these properties, you can use rest separator and work on the intended one:
// Example: updating length setSettings(prev => ({ ...prev, length: newLength }));
Amazing work — keep making us feel jealous! 😁
Marked as helpful
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord