Код: Выделить всё
const IdTypes = [
{
label: 'Identifications Type',
key: 'typeCd',
options: [] as string[],
type: 'select',
},
< /code>
] < /p>
const rows = ['0001', '0002']
{rows.map((seq, index) => (
{IdTypes.map((field) => {
{ field.options = [] }
{
getDropdownData(jsonData, 'typeCd').map(item => {
field.options?.push(item.cd + ' - ' + item.desc)
})
}
return (
{renderField(field)}
)
})}
)}
const renderField = (field: any) => {
const { label, type, key, options } = field
if (type === 'select') {
return (
(
{label}
{(options || []).map((option: string, index: any) => (
{option}
))}
)}
/>
)
}
Подробнее здесь: https://stackoverflow.com/questions/796 ... unique-key