How to set selected programmatically #5072
Unanswered
monicai18n
asked this question in
Q&A
Replies: 1 comment
-
Here is how I did it: const dummy=[{label:'Grade A',value:'Grade 10-A'}] <Select
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I will be getting some form data and would like to set the data in the react state. Once I have the value in the state how can I set selected
programmatically in react-select on single select and multi select.
I also tried something like this in render:
getOptionValue={this.getOptionValue}
function:
getOptionValue = option => option.key;
and setting value like this in the state: let newValue = {value:'Buggy'};
But the option does not get selected.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions