How can I get the combobox value

I have a react project written in Javascript with functional components and with the use of react hooks.


1 Reply 1 reply marked as answer

DR Deepak Ramakrishnan Syncfusion Team October 18, 2021 03:29 PM UTC

Hi Vipa Group team, 
 
Greetings from Syncfusion support. 
 
 
We have created a sample based on requirement , Kindly refer it for your reference. And we can get the value of the component using change event , It will return the value whenever the value get changed in the combobox component. 
 
const OnChange = (e) => { 
    console.log(e.value); 
  }; 
 
 
 
return ( 
    <ComboBoxComponent 
      id="combo-element" 
      fields={{ text: "name", value: "value" }} 
      dataSource={data} 
      value={selected} 
      change={OnChange} 
      allowFiltering={true} 
      placeholder="Select a type" 
      ref={selectRef} 
    /> 
  ); 
 
 
 
 
Thanks, 
Deepak R. 


Marked as answer
Loader.
Up arrow icon