I have been working on password generator and I want a feature that generates the initial password when the user opens the site.
This takes time to load lets say 1-2 seconds.
const [password, setPassword] = useState<string>("");
useEffect(() => {
setPassword(generatePassword(current));
}, []);
This renders the password twice…
const [password, setPassword] = useState<string>(generatePassword());
I am passing it in a input box.
<input type="text" disabled value={password} readOnly />