react-select
react-select copied to clipboard
React select `Create "New Option"` does not show up when using `getOptionLabel` and `getOptionValue`
Hello React Select Team,
I'm using react-select/creatable to create new options, when user enters new key options. Also i have getOptionLabel and getOptionValue to show and accept different value other than label and value coming from colourOptions array
<CreatableSelect classNamePrefix="select" onCreateOption={(val) => handleCreate(val)} name="color" getOptionLabel={(option) => option._id || ""} getOptionValue={(option) => option._id || ""} options={colourOptions} />
The problem is, i'm unable to see Create "New Option" as an option to create the dropdown value, Instead i'm seeing a blank row without the text.
I have created a working flow for this issue ( Code Sandbox Link ).
Please let me know what fixes do we have for this issue. Thanks
You can add a condition in getOptionLabel