So I am getting a prop from a parent component. let's say that attribute has a data structure like the following: [{a: "a", b:"b"}, {c:"c", d:"d"}...]
And this is the component that gets this prop.
class Child extends Component {
constructore(props){
super();
this.state = {items: []}
// props.name {a: "a", b: "b"}
}
render(){
return(
)
}
}
Now before I render that in the child component I would like to map this into something else like
for (let key in names){
items.push(<MenuItem value={names[key]}
key={key} primaryText={names[key]} />);
}
the end result would be.
class Child extends Component {
constructore(props){
super();
this.state = {items: [<MenuItem value={"a"}>,
<MenuItem value{"b"},....etc
}
render(){
return(
)
}
}