score:1

import { useRef } from 'react';

const inputRef = useRef();

<input ref={inputRef} type="text" required />

    const handleSubmit = (e: any) => {
        if (inputRef.current.value) {
        alert('submitting')
        }
        else {
         alert('empty input')
        }
    }

Related Query

More Query from same tag