[Autocomplete] Provide more details in the onChange event
See original GitHub issueIs there a way to get only the option that was added/removed in the onChange event handler? Controlled auto complete shows this as their onChange handler:
onChange={(event, newValue) => {
setValue(newValue);
}}
So when i use this for multiple my previous state is [A,B] and newValue is [A,B,C]. I have to diff the previous state with next state to see what was added or removed. When I tried using event.target.value, the first onChange returns 0
then after gives me the correct value that changed.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:14 (10 by maintainers)
Top Results From Across the Web
How to use onchange with autocomplete material ui?
The handleChange function in turn calls setLocation which updates the location state with the new value. To make user data entry easier, I ......
Read more >[Autocomplete] Provide more details in the onChange event
I am using two autocompletes for a form. When certain options are selected in one autocomplete, it requires options from the other autocomplete...
Read more >Change Event on autocomplete - Material Design for Bootstrap
Hi, the change event on autocomplete triggers before the value is actually changed, thus .val() still gives the old value.
Read more >React Autocomplete component - Material UI - MUI
The component has two states that can be controlled: the "value" state with the value / onChange props combination. This state represents the...
Read more >Autocomplete Widget - jQuery UI API Documentation
Description : Autocomplete enables users to quickly find and select from a pre-populated list of values as they type, leveraging searching and filtering....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
When a new option is selected I can check the last element added to
newValue
but for deletion I need to do a diff of previous state vs newValue. Which is also kind of made more difficult to distinguish forclear
If you guys don’t mind i’ll work on that.