javascript - Accessing nested objects (and its data) in a map function -
so have object array looks this:
i use map function create html render string this:
var renderbottles = bottlearray.map(bottle => ( <div> {bottle.bottleid} - {bottle.qty} <a href='#' onclick={ () => this.props.store.del(0)}>x</a></div> )) this works fine!
i like, however, access first object during map loop.
because i'm working firebase, name random, question is: how reference object based on location in object array , how retrieve nested data while in map function?
is possible?
i've been fiddling while not getting anywhere, appreciate help.
thanks!
if requested object value of type object do
for(var key in bottle) { if(typeof bottle[key] === 'object') { // bottle[key] desired object } } 


Comments
Post a Comment