JSFiddle - React, Tailwind, and code Playground
HTML
<textarea class="width-100" id="translated-text" onkeydown="myFunctionkey(event);" rows="10"></textarea>
<script>
function myFunctionkey(e) {
e.preventDefault();
conversion(e);
}
function conversion(e){
var x = document.getElementById('translated-text');
var text= e.keyCode;
if(text=='65'){
x.value +='yes';
}
if(text=='81'){
x.value+= 'are';
}
}
</script>