JSFiddle - React, Tailwind, and code Playground

HTML

<input id="input" value="3"/>

JavaScript

$("#input").change(function(){
    this.value = ("0" + Number(this.value)).slice(-2);
});