I would only skip the slug:
var options = this.props.options.map(option => {
return (
<option key={option.slug} value={option.slug}>
{option.value}
</option>
);
});
... and then retrieve the data using the bullet:
onChange: function(event, index, value) {
var option = this.props.options.find(option => option.slug === value);
this.props.onChange(this.props.name, value, option.continent, option.country);
}
(You would replace .findwith forEachor any other JS that you use if it does not support ES6.)
source
share