diff --git a/src/Select.tsx b/src/Select.tsx index e33abd5..06b3ceb 100644 --- a/src/Select.tsx +++ b/src/Select.tsx @@ -341,8 +341,9 @@ export const Select: FC> = ({ if (index > -1 || createable) { const newSelection = { - value: createable ? result[index]?.value : inputValue, - children: createable ? result[index]?.value : inputValue, + value: createable && result[index] ? result[index].value : inputValue, + children: + createable && result[index] ? result[index].value : inputValue }; toggleSelectedOption(newSelection);