'use client' import { useState, ChangeEvent, useEffect } from 'react'; import { InputMask } from '@react-input/mask'; import styles from '@/app/styles/module/login.module.scss'; interface PhoneInputProps { phoneState: string | undefined; validateHandler: (e: ChangeEvent) => void; clearCondition?: string | undefined | null } export default function PhoneInput({ phoneState, validateHandler, clearCondition }: PhoneInputProps) { const [phone, setPhone] = useState(phoneState ? phoneState : ''); useEffect(() => { if (clearCondition) { setPhone(''); } }, [clearCondition]) return ( { setPhone(e.target.value); validateHandler(e); }} placeholder="+7 (999) 123-45-67" /> ) }