JSFiddle - React, Tailwind, and code Playground
HTML
<input id="amount" name="amount" type="text" value="0" />
<input id="discount" name="discount" type="text" value="0" />
<input id="result" name="discount" type="text" value="0" />
JavaScript
$('input').focus(function () {
$("#result").val(parseInt($("#amount").val(), 10) - parseInt($("#discount").val(), 10));
});