I am taking help from this link how to set value in dropdown in react js?
set the value of dropdown.but it is not setting value in dropdown.
I am getting dropdown data after few seconds 3000 and then I need to set value on dropdown
expected output Aland Islands should be selected. { key: "ax", value: "ax", text: "Aland Islands" },
here is my code https://codesandbox.io/s/sharp-rhodes-140fm
const SingleSelectAutoComplete = props => {
const { onSearchChange, input, label, data, value } = props;
return (
<div>
<label>{label}</label>
<Dropdown
{...props.input}
clearable
fluid
search
closeOnChange
onChange={(e, data) => {
return input.onChange(data.value);
}}
onSearchChange={onSearchChange}
selection
options={data}
value={value}
placeholder="Select Country"
/>
</div>
);
};
const val = "ax";
const [state, setState] = useState([]);
const [value, setValue] = useState([]);
setTimeout(() => {
setState(data);
setValue("ax");
}, 2000);
const [val, setValue] = useState('ax');for starters