I have implemented the component, but the onChange is not firing no matter what I do.
My code looks like this:
<Select
name='select-user'
value={this.state.selectedUser}
options={this.selectUserOptions}
onChange={() => { alert('change!') }}
placeholder='Selecteer een gebruiker'
className='dark-select' />
I put the alert directly in the onChange property to make sure it isn't a scoping issue with the logChange method. But even this alert doesn't show.
I've used this component before and I'm familiar with it, which surprises me even more as this component has always functioned properly.
Any idea why the onChange doesn't fire, even if I call the alert directly inside the onChange?
Hi @pro-soft-git it's hard to say why this is not firing in your application. If you feel this is a bug in the package please provide a reproducible case.
Hi @agirton, I tried reproducing it and it works perfectly. It only doesn't work in a specific application, so I have to figure out what's causing this. I will report it here if it's something that can be fixed in react-select to prevent this in the future.
For now, you can ignore this, but could you keep this ticket open until I figure out what the issue is on my end (it may be a react-select issue after all)?
Thanks.
Edit: I found out that the react version I was using is an alpha version. This component doesn't work with the latest alpha version of React.
I'm using React 16 and I'm noticing onChange isn't firing for me either
Try using it with React and React-DOM version ^16.0.0-beta.5. With this version of v16, it does work for me.
Hello -
In an effort to sustain the react-select project going forward, we're closing old issues / pull requests.
We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our limited efforts to maintain the latest version.
If you feel this issue / pull request is still relevant and you'd like us to review it, please leave a comment and we'll do our best to get back to you.
Most helpful comment
I'm using React 16 and I'm noticing onChange isn't firing for me either