score:0

Accepted answer
function handleKeyDown(e) {
    if (e.key === 'Enter') {
        if (value) {
            handleSendMessage()
        }   
    }
}

Related Query

More Query from same tag