Skip to content

[Autocomplete] Provide more details in the onChange event #19064

@whuey1992

Description

@whuey1992

Is 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGreat for first contributions. Enable to learn the contribution process.scope: autocompleteChanges related to the autocomplete. This includes ComboBox.type: new featureExpand the scope of the product to solve a new problem.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions