JSFiddle - React, Tailwind, and code Playground

HTML

<form method="post" action="">
<input type="checkbox" name="key" />под ключ
<input type="text" name="sum_key" /> шт.
</form>

JavaScript

$("input[type=checkbox]").change(function() {
    if($(this).prop("checked") == true) {
        $("input[type=text]").val("1");
    } else {
        $("input[type=text]").val("");
    }
});