我是新来响应js的人。在这里,我有一个obj数组,
let criterias = [{
type: 'Low',
noc: 6,
data: this.props.lowData
}, {
type: 'Medium',
noc: 7,
data: this.props.MediumQuizData
},
{
type: 'High',
noc: 7,
data: this.props.HighData
}]
我正在这样使用
{criterias.map(criteria => (
<LowLevelCriteria techData={this.state.technologies} data={criteria.data} type={criteria.type} noc={criteria.noc} handler={this.handler.bind(this)} />
))}
现在,在LoweverCriteria.js
中,
{(this.props.data) && this.props.data.type.map((data, index) => (
<LowRow technologies={this.state.technologies} onChange={this.onchange.bind(this)} index={index + 1} data={data} key={data.id} onAddRow={this.onaddRow.bind(this)} onRemoveRow={this.onRemoveRow.bind(this)}
hasError={this.state.hasError}
/>
所以,在这里我想在这里使用道具,
this.props.data.{this.props.type}.map, so that type value is a dynamic. so I am not understanding How to do this ? I tried with
let type = this.props.type, and then using type , but no luck. so, can any one help me with this ?