bryantheastronaut / mernCommentBox

A Tutorial on creating a MERN Stack App from the Facebook Comment React Tutorial
https://medium.com/@bryantheastronaut/react-getting-started-the-mern-stack-tutorial-feat-es6-de1a2886be50
248 stars 92 forks source link

Warning displayed when posting comments #10

Open opudrovs opened 7 years ago

opudrovs commented 7 years ago

Hi Bryan,

I am still getting this warning (which was fixed for loading comments before) when posting a comment:

warning.js:35 Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `CommentList`. See https://fb.me/react-warning-keys for more information.
    in Comment (created by CommentList)
    in CommentList (created by CommentBox)
    in div (created by CommentBox)
    in CommentBox

The warning occurs in both code created when following your tutorial to the point before updating and deleting comments and this repo's code unchanged (except for the DB URL, login and password).

Maybe there is a conflict between id and _id somewhere between the comment just submitted and comments loaded? I think I managed to fix the warning by switching to using either id or _id somewhere, but I don't think it's the right way.

tygas commented 6 years ago

Should be fixed with PR