The problem is that I'm unable to manually trigger onChange callback on input component in React. I have a custom 'file picker' which changes the input's value of new selected file path. I want to manually dispatch a 'change'/'input' event for this input.
Example case:
<input onChange={(e) => console.log(e.target.value)} />
const inputRef = /* ref of input above */
/* .. */
const newValue = 'path/test.ext';
inputRef.current.value = newValue;
// dispatch change event for inputRef.current to console log new value
I'd like to point out that I've already researched the subject. The newest solution I've could find is: https://stackoverflow.com/a/71340077/14175627
Sadly, this solution doesn't work anymore and I'm unable to find working one.