JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" id="box1" onfocus="clearOther('box2')" />
<input type="text" id="box2" onfocus="clearOther('box1')"  />

JavaScript

function clearOther(which){
 document.getElementById(which).value='';
}