actually I want to display the users from my db in a table..I have a password that I want to display points instead of it..anyone could help me doing this? this how I display the password
<td> <Lock size={14} color=" #273746 " /> {item.password}</td>
I would be very thankful if anyone of you can help mee
If you want to generate a string of asterisks with the same length as the original string (e.g. item.password), then you can utilize the String.prototype.repeat method:
"*".repeat("mysecretpassword".length); // "****************"
However, I would advise showing a constant number of asterisks not related to the passwords because it is significantly easier to hack a password if a malicious person knew the number of characters was in it by counting the asterisks if they had, for example, taken a picture of the hidden passwords list. Therefore, I think you're best bet would be to just hard code a certain number of asterisks and show it for all of the passwords:
"**********"
answers above look correct but I just need to remember you that you shouldn't ever get text/plain passwords from your API. further, you shouldn't keep passwords in text/plain on database. if you really need to keep them in text/plain form, you already need to mask them on back-end before sending them to the client (front-end).
You can use Javascript string replace function. You can find it here : https://www.w3schools.com/jsref/jsref_replace.asp
{item.password.replace({item.password}, "**********")}