React version: 16.x.x
Link to code example:
Please, see this example. Notice that the the console has no logs since the change event can't be programmatically triggered.
linkin React 16.x.x
link in React 16.x.x
This is relying on an internal flag which was never a part of the public API (so it was not expected to work). That solution is wrong.
Here's a version that works and doesn't rely on this flag: https://codesandbox.io/s/serene-snyder-l3sj0?file=/src/App.js
Thanks @gaearon
Please @gaearon what about for a <select/> tag ? How does one programmatically trigger a chnage event on a <select /> tag.
@isocroft Is this the behavior you're looking for? https://codesandbox.io/s/summer-wave-p634m?file=/src/App.js
Yes, it is... I did figure it out myself here earlier than you replied. But, i will be using your version for my needs. It's much more compact and better written than mine.
Thanks a lot @samie820
My pleasure! @isocroft
Most helpful comment
This is relying on an internal flag which was never a part of the public API (so it was not expected to work). That solution is wrong.
Here's a version that works and doesn't rely on this flag: https://codesandbox.io/s/serene-snyder-l3sj0?file=/src/App.js