0
通過this.params我有父母與兩個道具:實體和選項。我想發送給每個實體作爲參數的選項。我怎樣才能做到這一點?我試着用:我如何通過這個通過地圖功能ReactJS
class FormsList extends React.Component{
constructor(props){
super(props);
};
render(){
var items = this.props.entities.map(function(entity){
return(
<Child data={entity} key={entity.Id} moredata={this.props.options}/>
);
});
return(
<MuiThemeProvider muiTheme={getMuiTheme()}>
<List children={items}/>
</MuiThemeProvider>
);
};
};
我知道PARAMS不在entities.map函數體訪問,但我應該怎麼選項傳遞給孩子?
偉大的作品,謝謝! – laik
代替'.bind(this)',將'this'作爲第二個參數傳遞給'.map'。 –