My code works properly and when I write in the password field, the text is hidden. Is there any way to add a functionality where the user has the option to view the password if he/she wants?
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
return (
<div>
<div className='main-content'>
<form className="form" noValidate autoComplete="off">
{[{ label: "Email", state: email , type: "text", function: setEmail},
{ label: "Password", state: password , type: "password", function: setPassword},
].map((item, index) => (
<div>
<TextField
id="outlined-basic"
key={index}
label={item.label}
variant="outlined"
type= {item.type}
onChange= {e => item.function(e.target.value)}
/>
<br></br><br></br>
</div>
)
)}
</form>
</div>
</div>
);
}

