Liightninggod
Liightninggod

Reputation: 65

Getting value of a Fluent UI dropdown without TypeScript in ReactJS

As you all know, in a normal dropdown, you can get the value of it onchange with onChange={e => this.setState({ whatever: e.target.value })}. The thing is, in Fluent UI React, this does not work, since it has a custom value handling system. In the Fluent UI docs it says to link the onChange function to:

const onChange = (event: React.FormEvent<HTMLDivElement>, item: IDropdownOption): void => {
    setSelectedItem(item);
  };

My project has to be TypeScript free because it is integrating with another application in a special way. Is there any way to get the value of this dropdown onChange rather than use Typescript?

Thanks!

Upvotes: 0

Views: 2525

Answers (1)

Mustafa Adenwala
Mustafa Adenwala

Reputation: 26

You can call the callback function on onChange of the Dropdown and pass event and option as two argument to the callback.

For Example

onChange = (event, option) => {
}

Upvotes: 1

Related Questions