React: Trigger onChange if input value is changing by state? override the value of input box
input = document.getElementById(id-of-the-input-box); lastValue = input.value; console.log(lastValue) input.value = new-value-here; event = new Event(“change”, { bubbles: true }); tracker = input._valueTracker; if (tracker) { tracker.setValue(lastValue); } input.dispatchEvent(event);