I'm new to Material UI and everything in the examples is static. Is there something to see for a JSON example?
1 Answer
Write it like this:
"Buckets": [
{"Name": "elasticb-east-1-6532860766", "CreationDate": "2014-09-01T16:58:41Z"},
{"Name": "elasticbeanstalk-860766", "CreationDate": "2015-10-06T00:24:57Z"},
{"Name": "elasticbeansta", "CreationDate": "2015-10-02T17:37:19Z"}
]
<Menu>
{
this.state.Buckets.map((el,i) => (<MenuItem key={i} primaryText={el.Name} />))
}
</Menu>
Assuming you will store the bucket values in the state variable.
4 Comments
Axwack
Thank you. I will try it and let you know.
Axwack
How does react know to make this iteration in HTML?
Mayank Shukla
we don't write html with react, its jsx :), there we can write js in
{}, i will suggest to check doc first, you will get answer of all your doubts. DocMayank Shukla
let me know if you have any doubt after that :)
[values here].map(el => <Menu />)