How get index in Array type Field
rgnevashev opened this issue · 2 comments
rgnevashev commented
<Field fieldName="sections" type={Array}>
<Field fieldName="type" type={Select} />
{this.state.sections[<how get index here?>].type === 'value' &&
<Field fieldName="headline" type={Text}>
}
</Field>
nicolaslopezj commented
class Payments extends React.Component {
renderItem (item, index) {
return (
<div>
<Field fieldName="type" type={Select} />
{this.state.sections[index].type === 'value' &&
<Field fieldName="headline" type={Text} />
}
</div>
)
}
render () {
return (
<Form>
<Field
fieldName='sections'
type={Array}
renderItem={this.renderItem.bind(this)} />
</Form>
)
}
}
rgnevashev commented
Thank you very much! cool a way)