I am using react select to create a dropdown of options. I want to access the label on the dropdown but also access an associated value with the data. For example:
import Select from 'react-select'
let options = [
{
label: Small,
change: -3
},
{
label: Medium,
change: 0
}
]
<Select id={"options"} defaultValue={options[0]} options={options} />
let selectedChange = // How can I access the change property?
let selectedLabel = document.querySelector(`#options`).textContent // This is how I have been getting the proper label
<button onClick={console.log(selectedChange, selectedLabel)}></button>
I would like to change the displayed cost of the item by adding the options change value to the default price, but I would only like to display the label in the select.