How to get cancel button click event on Creatable react-select

Viewed 122

I have been working on a project where I have used react-select creatable custom CreateSelect option (Multi Select input Text).

Now All I need is when I am adding any values I am able to add it easily. But when I am trying to remove the item that time I am checking in onChange function as mentioned in the example but all I am getting is full list of options. Here is my code snippet :

     <CreatableSelect
            placeholder={subDevice.text}
            isMulti
            inputValue={subDeviceVal}
            onInputChange={onInputChange}
            components={components}
            onKeyDown={handleKeyDown}
            onChange={onDelete.bind(this)}
            menuIsOpen={false}
            isClearable={false}
            value={targets}
          />

I am trying to delete the option and for that I need the clicked option. But I am not getting it. Is there any way that I can get the selected value here? I tried using bind(this) as well but it still gives me while list. All I want is the value which is being selected to be deleted.

0 Answers
Related