What is the best way to trigger change or input event in react js
For React 16 and React >=15.6 Setter .value= is not working as we wanted because React library overrides input value setter but we can call the function directly on the input as context. var nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, “value”).set; nativeInputValueSetter.call(input, ‘react 16 value’); var ev2 = new Event(‘input’, { bubbles: true}); input.dispatchEvent(ev2); For textarea element you … Read more