I am working with react-select and need to add the text as in the image 'default category' based on some condition. Any way to achieve this?
My code:
renderCategories(categories) {
const temp = [];
categories.forEach((key) => {
temp.push({label: key.name, value: key.id.toString()});
});
return temp;
}
<Field
name="event_category"
component={renderSelectField}
placeholder="Select Event Category"
options={this.renderCategories(categories)}
/>
where renderSelectField is the Select component of react-select, using redux-form and categories is an array of objects containing id and name.
