Answer the question
In order to leave comments, you need to log in
REACT how to loop around objects with an array inside an array?
I ran into a problem, there is an array in which objects will be added gradually with the help of requests, inside the object there is also an array that I need to draw on the page
It seemed to me that getting to the array in the object was not difficult, I had to first bypass the entire array map function, and then in the selected object I select an array, and I go through it. But for some reason nothing is displayed and no error is given. Apparently React doesn't understand such double nesting, or I'm doing something wrong, so that more likely
the array itself looks like this: [{...},{...}, etc.]
object: {
releases: [ {...},{...}],
total: 130,
page: 1
}
{films !== [] ? films.map(item=>{
item.releases.map(film=>{
return <Slide key={film.filmId} id={film.filmId} src={film.posterUrl} name={film.nameRu !== '' ? film.nameRu : film.nameEn} year={film.year}/>
})
}): null}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question