fix this react code that only when hold on click password is reveal else back to conceal…
- User
fix this react code that only when hold on click password is reveal else back to conceal import React, { useState } from 'react'; import './PasswordInput.scss'; import { FiEye, FiEyeOff } from 'react-icons/fi';
const PasswordInput = ({ placeholder, value, onChange, name, onPaste }) => { const [showPassword, setShowPassword] = useState(false); const togglePassword = () => { setShowPassword(!showPassword); }; return (
{showPassword ? (
) : (
)}
); };
export default PasswordInput;
- Assistant
import React, { useState } from 'react'; import './PasswordInput.scss'; import { FiEye, FiEyeOff } from 'react-icons/fi';
const PasswordInput = ({ placeholder, value, onChange, name, onPaste }) => { const [showPassword, setShowPassword] = useState(false); const togglePassword = (event) => { if (event.type === 'mousedown') { setShowPassword(true); } else if (event.type === 'mouseup') { setShowPassword(false); } }; return (
export default PasswordInput;