Q: Array.map inside Array.map is not working I am getting an array of object returned from Database.I want to map that array and inside that i want to map another array.But i am getting some error. If anyone knows please help out with this problem.
displayMovies(){
    if(!this.state.body) return ( <h2> Loading.... </h2>)
    else{

        return this.state.body.map((data) => {
            return(
                <div key={data._id}>
                    <li> {data.name} </li>
                    <ul>
                        {
                            return data.map((cast) => {
                                return <li> cast.name </li>
                            })
                        }
                    </ul>
                </div>
            )
        })
    }
}

Data response

A: You are not in any function inside nested loop so you do not  need to return any thing
Replace 
 return data.map((cast) => {

to 
data.map((cast) => {

and add apply map function on cast property of data
displayMovies(){
    if(!this.state.body) return ( <h2> Loading.... </h2>)
    else{

        return this.state.body.map((data) => {
            return(
                <div key={data._id}>
                    <li> {data.name} </li>
                    <ul>
                        {
                            data.cast.map((cast) => {
                                return <li> {cast.name} </li>
                            })
                        }
                    </ul>
                </div>
            )
        })
    }
}


A: Your first map function returns an Object. Objects don't have map function use a for in loop instead, inside the loop, check if the property is an object.
Replace second map with something like this :
for (const key in object) {
  if (object.hasOwnProperty(key) && typeof(object[key]=='object') {
    // do something with object[key].name 
  }
} 

