I'm not sure how to explain my problem, but my API sends the information in objects:
"brand": {
"id": 48,
"name": "Nike"
},
And i need to edit this brand, when i pass this brands on Initial values:
function mapStateToProps(state, props) {
const quality = state.quality;
const edition = state.editionBox;
const levels = state.levels;
const tenant = state.tenant;
const productID = props.match.params.id;
if (productID) {
// eslint-disable-next-line
return { initialValues: state.products.productList.find(product => product.id == productID), levels, quality, edition, tenant}
} else {
return { brands: state.brands, levels, quality, edition, tenant }
}
}
My component, expect to just a brandName, not id and name
<Field
name="brand"
label="Marca"
component={RenderedSelect}
validate={[required]}>
{brandsList.map(brand => (
<MenuItem key={brand.id} value={brand.name}>
{brand.name}
</MenuItem>
))}
</Field>
This is my redux when i select a brand, i need to get the ID and Name
EDIT: i got this error no console:
EDIT2: My brandList coming from useSelector from redux-state
const brandsList = useSelector(state => state.brands.brandList);

