DPigeon / Edge

A web-base application kind of like a social media site to allow parents to communicate with teachers and vice-versa.
0 stars 1 forks source link

Displaying Comments bugs #111

Closed DPigeon closed 5 years ago

DPigeon commented 6 years ago

Anyone can resolve this ?

bug

I am trying to display an array of an array (posts being in comments) on React's Javascript. Yes, I am using the right method with .map(). I am passing the entire posts array to this.props.posts and I am trying to get all the comment lists to show with it. I just don't get why after I run the website that this error occurs: eee

Thanks

AnasBuyumad commented 6 years ago

[11/15, 3:36 PM] Anas: Looks like you are indexing at the wrong place @⁨David⁩ [11/15, 3:37 PM] Anas: Your data is an array of object, and each object has a key "message list" which is an array right? [11/15, 3:39 PM] Anas: So the indexing should be on post (post[i]) [11/15, 3:39 PM] Anas: And the for every post you get the comment list and use the map function to render like you're doing

DPigeon commented 6 years ago

I think I tried that too by doing this.state.posts[i].commentList. I was only able to get all the comments only on post 1 though

DPigeon commented 5 years ago

I fixed this. dddd