import React, { useEffect, useState } from "react"; import Dropdown, { Option } from "react-dropdown"; import "react-dropdown/style.css"; const AudioInputsDropdown: React.FC<{ audioDevices: Option[]; disabled: boolean; hide: () => void; setDeviceId: React.Dispatch>; }> = (props) => { const [ddOptions, setDdOptions] = useState([]); useEffect(() => { if (props.audioDevices) { setDdOptions(props.audioDevices); props.setDeviceId( props.audioDevices.length > 0 ? props.audioDevices[0].value : null, ); } }, [props.audioDevices]); const handleDropdownChange = (option: Option) => { props.setDeviceId(option.value); props.hide(); }; return ( ); }; export default AudioInputsDropdown;