By clicking a button a have to set the default value/value into the dropdown list.
I am not able to display the selected value inside the option dropdown, I tried with both state and hardcoded defaultValue/value but the dropdown still renders the list as it is from parent component
Here a codesandbox:
https://codesandbox.io/s/stupefied-borg-99bic?file=/src/App.js:3419-3912
Thank you
Your Select
component is accepting default value/value in following format
id/type
.
So you need to change the way you are storing selected value in handleClick
function like below:-
setSelectedValue(`${removedUndefined[0].id}/${removedUndefined[0].type}`);