diff --git a/src/Dropdown.tsx b/src/Dropdown.tsx index 2baa04c..940a281 100644 --- a/src/Dropdown.tsx +++ b/src/Dropdown.tsx @@ -37,7 +37,7 @@ export const Dropdown: React.FC = ({ isClearable, }) => { const options = prepareOptions(originalOptions); - const [selected, setSelected] = useState( + const [selected, setSelected] = useState(() => findSelected(options, value, matcher), ); const [isOpen, setIsOpen] = useState(false); diff --git a/src/Selection.tsx b/src/Selection.tsx index 054ab9f..f99550d 100644 --- a/src/Selection.tsx +++ b/src/Selection.tsx @@ -20,7 +20,7 @@ export const Selection: React.FC = ({ menu: MenuContainer, }) => { const options = prepareOptions(originalOptions); - const [selected, setSelected] = useState( + const [selected, setSelected] = useState(() => findSelected(options, value, matcher), );