-1

I am trying to get input field value whatever user type in input field.using this input text I am trying to fetch data from server and display on dropdown .then select value from dropdown

Here is my code

https://codesandbox.io/s/semantic-ui-react-example-7iy8l

API LINK https://react.semantic-ui.com/modules/dropdown/#types-clearable-multiple

 <Dropdown
    clearable
    fluid
    multiple
    search
    selection
    options={countryOptions}
    placeholder='Select Country'
  />
Ignazio
  • 10,504
  • 1
  • 14
  • 25
user944513
  • 12,247
  • 49
  • 168
  • 318
  • use `onSearchChange` Props of react-semantic-ui ... `onSearchChange={(event) => {console.log(event.target.value)}}` – Double H Jul 29 '19 at 08:14

1 Answers1

-3

If you need to fetch selected value then you need to use e.target.textContent and by using that you can call API from that function also you can store that value in state or variable as per your needs.

export default class DropdownExampleClearableMultiple extends React.Component {
  getValue = (e) => {
    console.log(e.target.textContent);
  };

  render() {
    return (
      <Dropdown
        clearable
        fluid
        multiple
        search
        selection
        options={countryOptions}
        placeholder="Select Country"
        onChange={this.getValue}
      />
    );
  }
AddWeb Solution Pvt Ltd
  • 21,025
  • 5
  • 26
  • 57