'How to get both value and label of SelectControl?
I am trying to get both the value and label in a SelectControl.
If I do:
<SelectControl
label={ __( 'Content Type' ) }
value={ contenttype }
options={ contenttypeControlOptions }
onChange={ ( selectedContentTypeOption ) => {
props.setAttributes( {
contenttype: selectedContentTypeOption,
contentlabel: ?,
} );
} }
/>
I get the value just fine. But how to set the label as well? I thought the variable selectedContentTypeOption would be an object for the selected item but it is just a string for the option value. I am new to React so perhaps there is something obvious I am overlooking!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
